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
- What type to use for a year in Mariadb?
- How to work with XML in Mariadb?
- How to use xtrabackup in Mariadb?
- How to check version of Mariadb?
- How to use UUID in Mariadb?
- How to change wait_timeout in Mariadb?
- How to use the WITH clause in Mariadb?
- Working with JSON in Mariadb
- How to list available engines in Mariadb?
- How to backup all databases in Mariadb?
See more codes...