How can we add a time interval to date stored in a column of MySQL table?

MySQLMySQLi Database

MySQL ADDTIME() function can be used to add a time interval in the data stored in a column of the table. The syntax of this function is ADDTIME(date, ‘expression unit’). It can be demonstrated by following the example which uses the data from table ‘collegedetail’.

mysql> Select estb, ADDTIME(estb, '05:04:25')AS 'Date with time' From collegedetail WHERE ID = 111;
+------------+---------------------+
| estb       | Date with time      |
+------------+---------------------+
| 2010-05-01 | 2010-05-01 05:04:25 |
+------------+---------------------+
1 row in set (0.02 sec)

Here, ‘estb’ is a column of table ‘collegedetail’ having the date as values.

raja
Published on 21-Feb-2018 07:04:31
Advertisements