CodesJava

Easy learning with example program codes

ADDTIME() FUNCTION in MySQL

ADDTIME() FUNCTION
The MySQL ADDTIME function is used to get a time value after adding a certain time interval. The various versions of MySQL supports the ADDTIME function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0 and MySQL 4.1.1.

Syntax:

ADDTIME( start_value, time )

Parameters:
start_value: It is used to specify the time to which the interval should be added.
time: It is used to specify the time interval to be added.

Example 1:

mysql> SELECT ADDTIME ('2019-07-05 15:30:20.000003', '1.000005');

Output:

'2019-07-05 15:30:21.000008'

Explanation:
The desired time interval has been added to the start_value of the time.

Example 2:

mysql> SELECT ADDTIME ('15:30:20.000003', '5:6:7.000005');

Output:

'20:36:27. 000008'

Explanation:
The desired time interval has been added to the start_value of the time.

Please follow and like us:
error









Copyright © 2019 CodesJava DMCA.com Protection Status