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 check version of Mariadb?
- How to list users in Mariadb?
- How to use UUID in Mariadb?
- Mariadb partitioning example
- How to get current year in Mariadb?
- How to work with XML in Mariadb?
- How to view Mariadb logs?
- Mariadb fulltext search example
- How to use window functions in Mariadb?
See more codes...