Home >Database >Mysql Tutorial >How to Add a Day to the MySQL NOW() Function?
How to Add a Day to NOW() Function in MySQL
MySQL's NOW() function returns the current date and time. In certain scenarios, it may be necessary to modify this timestamp to represent a future date. This article explores how to add one day to the NOW() function in MySQL.
Solution:
To add one day to the NOW() function, you can use the INTERVAL keyword. The syntax is as follows:
NOW() + INTERVAL 1 DAY
This expression will return a timestamp that represents the current date and time plus one day. For example:
SELECT NOW() + INTERVAL 1 DAY;
This query will return a result similar to:
2023-03-09 10:30:15
Note: If you are only interested in the date, not the date and time, you can use CURDATE instead of NOW. The CURDATE() function returns the current date.
Example:
SELECT CURDATE() + INTERVAL 1 DAY;
This query will return the following result:
2023-03-09
The above is the detailed content of How to Add a Day to the MySQL NOW() Function?. For more information, please follow other related articles on the PHP Chinese website!