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 get current year in Mariadb?
- What type to use for a year in Mariadb?
- How to use XA transactions in Mariadb?
- How to work with XML in Mariadb?
- How to change wait_timeout in Mariadb?
- How to use window functions in Mariadb?
- How to use the WITH clause in Mariadb?
- How to check version of Mariadb?
- How to install Mariadb on Ubuntu?
See more codes...