MariaDB Data and Time Functions

This page organizes commonly used date and time functions in MariaDB.

  1. ADD_MONTHS()

    In MariaDB, ADD_MONTHS() is a built-in function that adds a given number of months to a given date and returns the result.
  2. ADDDATE()

    In MariaDB, the ADDDATE() function adds the specified time interval to the specified date/time and returns the operation result.
  3. ADDTIME()

    In MariaDB, ADDTIME() is a built-in function that adds a specified time interval to a specified time and returns the result.
  4. CONVERT_TZ()

    In MariaDB, CONVERT_TZ() is a built-in function used to convert a datetime value from one time zone to another.
  5. CURDATE()

    In MariaDB, CURDATE() is a built-in function that returns the system’s current date in YYYY-MM-DD or YYYYMMDD format.
  6. CURRENT_DATE()

    In MariaDB, CURRENT_DATE() is a built-in function that returns the system’s current date in YYYY-MM-DD or YYYYMMDD format.
  7. CURRENT_TIME()

    In MariaDB, CURRENT_TIME() is a built-in function that returns the current time.
  8. CURRENT_TIMESTAMP()

    In MariaDB, CURRENT_TIMESTAMP() is a built-in function that returns the current date and time.
  9. CURTIME()

    In MariaDB, CURTIME() is a built-in function that returns the current time.
  10. DATE_ADD()

    In MariaDB, DATE_ADD() is a built-in function that adds the specified time interval to the specified date/time and returns the result.
  11. DATE_FORMAT()

    In MariaDB, DATE_FORMAT() is a built-in function that formats a date/time according to a given format string.
  12. DATE_SUB()

    In MariaDB, DATE_SUB() is a built-in function that subtracts the specified time interval from the specified date/time and returns the new date/time.
  13. DATE()

    In MariaDB, DATE() is a built-in function that extracts date parts from the gaven datetime expression.
  14. DATEDIFF()

    In MariaDB, DATEDIFF() is a built-in function that returns the difference between two dates in days.
  15. DAY()

    In MariaDB, DAY() is a built-in function that returns the number representing the day of the month in a given datetime expression.
  16. DAYNAME()

    In MariaDB, DAYNAME() is a built-in function that returns the weekday name for a given date.
  17. DAYOFMONTH()

    In MariaDB, DAYOFMONTH() is a built-in function that returns a number representing the day of the month in a datetime expression.
  18. DAYOFWEEK()

    In MariaDB, DAYOFWEEK() is a built-in function that returns a number representing the weekday for a given date.
  19. DAYOFYEAR()

    In MariaDB, DAYOFYEAR() is a built-in function that returns a number representing the day of the year for a given date.
  20. EXTRACT()

    In MariaDB, EXTRACT() is a built-in function that extracts specified parts from a given date or datetime expression.
  21. FROM_DAYS()

    In MariaDB, FROM_DAYS() is a built-in function that converts the specified number of days from standard time (0000-00-00) to a date and returns it.
  22. FROM_UNIXTIME()

    In MariaDB, FROM_UNIXTIME() is a built-in function that converts a given unix timestamp to a datetime value.
  23. GET_FORMAT()

    In MariaDB, GET_FORMAT() is a built-in function that returns a formatted string according to the parameters.
  24. HOUR()

    In MariaDB, HOUR() is a built-in function that returns the hour part from a given time expression.
  25. LAST_DAY

    In MariaDB, LAST_DAY is a built-in function that returns the last day of the month for a given date.
  26. LOCALTIME()

    In MariaDB, LOCALTIME() is a built-in function that returns the current date and time.
  27. LOCALTIMESTAMP()

    In MariaDB, LOCALTIMESTAMP() is a built-in function that returns the current date and time.
  28. MAKEDATE()

    In MariaDB, MAKEDATE() is a built-in function that constructs a date base on the given year and the number of days in the year.
  29. MAKETIME()

    In MariaDB, MAKETIME() is a built-in function that creates a time from given hours, minutes, and seconds.
  30. MICROSECOND()

    In MariaDB, MICROSECOND() is a built-in function that extracts the microsecond portion of a time or datetime and returns it as a number.
  31. MINUTE()

    In MariaDB, MINUTE() is a built-in function that extracts and returns the minutes portion of a given time expression.
  32. MONTH()

    In MariaDB, MONTH() is a built-in function that extracts the month part from a given date expression and returns it as a number.
  33. MONTHNAME()

    In MariaDB, MONTHNAME() is a built-in function that returns the month name for a given date.
  34. NOW()

    In MariaDB, NOW() is a built-in function that returns the current date and time.
  35. PERIOD_ADD()

    In MariaDB, PERIOD_ADD() is a built-in function that adds the specified number of months to the specified year and month and returns the result as a year and month.
  36. PERIOD_DIFF()

    In MariaDB, PERIOD_DIFF() is a built-in function that returns the number of months between two periods specified by year and month.
  37. QUARTER()

    In MariaDB, QUARTER() is a built-in function that returns the quarter from a given date expression.
  38. SEC_TO_TIME()

    In MariaDB, SEC_TO_TIME() is a built-in function that returns a time value converted from a given number of seconds.
  39. SECOND()

    In MariaDB, SECOND() is a built-in function that returns the seconds portion of a given time expression.
  40. STR_TO_DATE()

    In MariaDB, STR_TO_DATE() is a built-in function that converts a given date string to a date/time/datetime according to a specified format string.
  41. SUBDATE()

    In MariaDB, SUBDATE() is a built-in function that subtracts a given time interval from a given date.
  42. SUBTIME()

    In MariaDB, SUBTIME() is a built-in function that subtracts a time from a time or datetime expression.
  43. SYSDATE()

    In MariaDB, SYSDATE() is a built-in function that returns the current date and time.
  44. TIME_FORMAT()

    In MariaDB, TIME_FORMAT() is a built-in function that formats a given time according to a given format.
  45. TIME_TO_SEC()

    In MariaDB, TIME_TO_SEC() is a built-in function that converts a given time value to seconds.
  46. TIME()

    In MariaDB, TIME() is a built-in function that extracts the time part from a given time or datetime expression and returns it as a string.
  47. TIMEDIFF()

    In MariaDB, TIMEDIFF() is a built-in function that returns the difference between two time or datetime values.
  48. TIMESTAMP()

    In MariaDB, TIMESTAMP() is a built-in function that sums all arguments and returns the result as a datetime value.
  49. TIMESTAMPADD()

    In MariaDB, TIMESTAMPADD() is a built-in function that adds the specified time interval to a datetime value and returns the result.
  50. TIMESTAMPDIFF()

    In MariaDB, TIMESTAMPDIFF() is a built-in function that returns the difference between two datetimes.
  51. TO_DAYS()

    In MariaDB, TO_DAYS() is a built-in function that returns the number of days since 0 year (0000-00-00) for a given date.
  52. TO_SECONDS()

    In MariaDB, TO_SECONDS() is a built-in function that returns the number of seconds since the 0 year (0000-00-00) for a given datetime.
  53. UNIX_TIMESTAMP()

    In MariaDB, UNIX_TIMESTAMP() is a built-in function that converts a specified date/datetime to a UNIX timestamp value.
  54. UTC_DATE()

    In MariaDB, UTC_DATE() is a built-in function that returns the current UTC date.
  55. UTC_TIME()

    In MariaDB, UTC_TIME() is a built-in function that returns the current UTC time.
  56. UTC_TIMESTAMP()

    In MariaDB, UTC_TIMESTAMP() is a built-in function that returns the current UTC date and time.
  57. WEEK()

    In MariaDB, WEEK() is a built-in function that returns the week of the year for a given date.
  58. WEEKDAY()

    In MariaDB, WEEKDAY() is a built-in function that returns the weekday number for a given date.
  59. WEEKOFYEAR()

    In MariaDB, WEEKOFYEAR() is a built-in function that returns the week number for a given date.
  60. YEAR()

    In MariaDB, YEAR() is a built-in function that returns the year from a given date expression.
  61. YEARWEEK()

    In MariaDB, YEARWEEK() is a built-in function that returns the year and week number of a given date.