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.

Updated on 30-Jul-2019 22:30:21