webCOMAND

ADDTIME()

Add a time to a timestamp.  time can include days, and timestamp can be a time, which will produce a time result, instead of a timestamp result.

Prototype

mixed ADDTIME(mixed $start_time, time $time)

Parameters

  • start_time - A time (HH:MM:SS) or timestamp (YYYY-MM-DD HH:MM:SS) or hybrid, including "DD HH:MM:SS", "MM:SS" or just "SS".
  • time - A positive or negative amount of time to add to the start time in a format like "DD HH:MM:SS", "DD HH:MM", "HH:MM" or "SS", where DD is any number of days, HH is any number of hours, MM is 0-59 minutes and SS is 0-59 seconds.

Return

If a time is provided, the adjusted time string is returned.  If a timestamp is provided, the adjusted timestamp string is returned.  If there is an error, such as an invalid time, NULL is returned.

Example

SELECT OID, Start, ADDTIME(Start, '-1 12:00:00') AS TimeDue FROM Task