Home  >  Article  >  Database  >  How to add a day to DATETIME field in MySQL query?

How to add a day to DATETIME field in MySQL query?

WBOY
WBOYforward
2023-08-29 09:09:121507browse

如何在 MySQL 查询中向 DATETIME 字段添加一天?

With the help of DATE_ADD() function, we can add a day to the DATETIME field of the table.

mysql> Select StudentName, RegDate, Date_ADD(RegDate, INTERVAL +1 day) AS 'NEXT DAY'
       from testing where StudentName = 'gaurav';

+-------------+---------------------+---------------------+
| StudentName | RegDate             | NEXT DAY            |
+-------------+---------------------+---------------------+
| Gaurav      | 2017-10-29 08:48:33 | 2017-10-30 08:48:33 |
+-------------+---------------------+---------------------+
1 row in set (0.00 sec)

The above query will add a day to the RegDate (where StudentName is Gaurav) in the MySQL table named "testing".

The above is the detailed content of How to add a day to DATETIME field in MySQL query?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete