CURDATE() : Today's Date in MySQL
SELECT CURDATE();
Output is 2025-04-19
, this is in the format YYYY-MM-DD
Syntax of CURDATE()
CURDATE()
CURDATE() to get todays, yesterday and tomorrow date with first day last of previous , next months
NOW() & CURDATE()
By using CURDATE() we get the date part only, where as by using NOW() we will get both date and time.
Yesterday & Tomorrow date by usign CURDATE()
SELECT CURDATE()- interval 1 day as Yesterday,
CURDATE() as Today,
CURDATE()+ interval 1 day as Tomorrow
Yesterday | Today | Tomorrow |
2025-04-18 | 2025-04-19 | 2025-04-20 |
Last Month , Today and Next Month
SELECT CURDATE()- interval 1 month as LastMonth,
CURDATE() as Today,
CURDATE()+ interval 1 Month as NextMonth
Last Month | Today | Next Month |
2025-03-19 | 2025-04-19 | 2025-05-19 |
First Day of Previous Month
SELECT DATE_FORMAT(CURDATE() - INTERVAL 1 MONTH,'%Y-%m-01')
Last Day of Previous Month
SELECT LAST_DAY(CURDATE() - INTERVAL 1 MONTH)
Last Month First Day | Last Month Last Day |
2025-03-01 | 2025-03-31 |
Present Month Records
Starting from 1st day of the current month till now.
SELECT * FROM `dt_table` WHERE
date BETWEEN DATE_FORMAT(CURDATE() ,'%Y-%m-01') AND CURDATE()
More on BETWEEN DATE Query →
Adding current date and time by default to a record.
While storing a record MySQL can automatically insert date and time in a column.
Read more on how to store default date and time in MySQL table here.
Examples of CURDATE() to get different range of records.
← SQL Date References
Group By in Date field →
NOW() : Current Date with Time →
SQL file of CURDATE() queries →
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com