MySQL ADDTIME Function

MySQL ADDTIME is one of the Date Functions used to add time to an existing one or DateTime expression. The basic syntax of the ADDTIME Function is as shown below:

ADDTIME(DateTime1 or Time_Expression1, Time_Expression2);

This ADDTIME method adds the Time_Expression2 value to DateTime1 or Time_Expression1.

MySQL ADDTIME function Example

The following are the list examples that help you understand the use of this method to add a specified one to a given time or DateTime expression.

In this example, first, we are adding 12 Hours, 10 Minutes, and 12 Seconds to a time expression. Next, we added the same along with 111222 Microseconds.

SELECT ADDTIME('10:11:22', '12:10:12');

SELECT ADDTIME('10:11:22', '12:10:12.111222');

SELECT ADDTIME('10:11:22.333444', '12:10:12.111222');
Example 1

In this MySQL Add Time function example, we added 12 Hours, 10 Minutes, 12 Seconds, and 111222 Microseconds. Next, we used 90 Hours and 3600 Hours. The impact of adding these many hours change the date’s value too.

SELECT ADDTIME('2019-02-28 16:11:22.333444', '12:10:12.111222');

SELECT ADDTIME('2019-02-28 16:11:22.333444', '90:10:12.111222');

SELECT ADDTIME('2019-02-28 16:11:22.333444', '3600:10:12');
ADDTIME Function 2