How to Add One Day to a MySQL NOW() Timestamp
When using the NOW() function in MySQL to insert the current date and time into a database, there may be instances where you need to adjust the date by a certain interval, such as adding one day. Here's how you can achieve this:
Solution:
To add one day to a NOW() timestamp in MySQL, you can use the INTERVAL keyword along with the addition operator ( ):
NOW() + INTERVAL 1 DAY
This expression will result in a timestamp that is one day later than the current time.
Option for Date-Only Value:
If you only require the date without the time, you can use the CURDATE() function instead of NOW():
CURDATE() + INTERVAL 1 DAY
This will provide you with a date value that is one day after the current date.
The above is the detailed content of How to Add a Day to MySQL's NOW() Timestamp?. For more information, please follow other related articles on the PHP Chinese website!