ADDTIME
ADDTIME is a function in SQL that adds a specified time to a given time. The result is calculated as "time + time".
ADDTIME(time1, time2);
- time1: The first time value in the operation. This parameter represents the starting time that the second time value (time2) will be added to. It can be a TIME, DATE, or DATETIME type or a valid string representation of these types.
- time2: The second time value in the operation. This parameter is the amount of time to add to the first time value (time1). It can be a TIME type or a valid string representation of this type.
Example
Output
Explanation
The ADDTIME()
function in MySQL adds a specified time to a given time. The first argument is the original time, and the second is the time to be added. Above, ‘1:1:1’ was added to ‘2007-12-31 23:59:59’, resulting in ‘2008-01-01 01:01:00’.