Calculating Date and Time

Section 2. Calculating Date and Time

  • ADDTIME() – Add a time interval to a time value or datetime value.
  • DATE_ADD() – Add a time value to a date (synonyms: ADDDATE()).
  • DATE_SUB() – Subtract a time value (interval) from a date.
  • DATEDIFF() – Return the difference in days of two date values.
  • TIMEDIFF() – Return the difference of two time values.
  • TIMESTAMPADD() – Add or subtract an interval from a timestamp or date.
  • TIMESTAMPDIFF() – Return the difference between two timestamp values.
  • TIME_TO_SEC() – Return the number of seconds from a time argument.
  • TO_DAYS() – Return a day number (the number of days since year 0) from a given date.

MySQL ADDTIME() Function