mariadbHow to get yesterday's date in Mariadb?
To get yesterday's date in Mariadb, you can use the DATE_SUB
function. This function takes two parameters, the first being the date you want to subtract from, and the second being the interval you want to subtract.
Example code
SELECT DATE_SUB(CURDATE(), INTERVAL 1 DAY);
Output example
2020-09-17
Code explanation
DATE_SUB
: This is the function used to subtract a date from another date.CURDATE()
: This is a function that returns the current date.INTERVAL 1 DAY
: This is the interval that is being subtracted from the current date.
Helpful links
More of Mariadb
- How to check version of Mariadb?
- What type to use for a year in Mariadb?
- How to change wait_timeout in Mariadb?
- How to use variables in Mariadb?
- Mariadb partitioning example
- Working with JSON in Mariadb
- How to list available engines in Mariadb?
- How to install Mariadb on Centos?
- How to install Mariadb on Ubuntu?
- How to get current year in Mariadb?
See more codes...