Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2023-08-29 09:09:12
forward
1586 people have browsed it

如何在 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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template