How can I add one day to DATETIME field in MySQL query?

MySQLMySQLi Database

With the help of DATE_ADD() function, we can add one day to the DATETIME field of a 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)

Above query will add one day to the RegDate where StudentName is Gaurav in MySQL table named ‘testing’.

raja
Published on 19-Feb-2018 10:27:45
Advertisements