MariaDB Date & Time Functions (Full List)

This article contains a full list of built-in MariaDB date and time functions.

The following is a list of date and time functions available in MariaDB. Click on each function name to see an explanation of the function, its syntax, and examples.

NameDescription
ADDDATE()Adds time values (intervals) to a date value.
ADD_MONTHS()Adds a given number of months to a given date.
ADDTIME()Adds time to a time value.
CONVERT_TZ()Converts from one time zone to another.
CURDATE()Returns the current date.
CURRENT_DATE()
CURRENT_DATE
Synonyms for CURDATE().
CURRENT_TIME()
CURRENT_TIME
Synonyms for CURTIME().
CURRENT_TIMESTAMP()
CURRENT_TIMESTAMP
Synonyms for NOW().
CURTIME()Returns the current time.
DATE()Extracts the date part of a date or datetime expression.
DATE_ADD()Adds time values (intervals) to a date value.
DATE_FORMAT()Formats the given date as specified.
DATE_SUB()Subtracts a time value (interval) from a date.
DATEDIFF()Returns the difference between two dates (subtracts one date from the other).
DAY()Synonym for DAYOFMONTH().
DAYNAME()Returns the weekday name of a given date.
DAYOFMONTH()Returns the day of the month (0-31) of a given date.
DAYOFWEEK()Returns the weekday index of a given date.
DAYOFYEAR()Returns the day of the year (1-366) of a given date.
EXTRACT()Extracts a date part from a given date.
FROM_DAYS()Returns a date, based on the given number of days from the start of the standard calendar (0000-00-00).
FROM_UNIXTIME()Formats a Unix timestamp as a date.
GET_FORMAT()Returns a date format string based on the input arguments.
HOUR()Extracts the hour from a given time or datetime expression.
LAST_DAY()Returns the last day of the month from its date argument.
LOCALTIME()
LOCALTIME
Synonym for NOW().
LOCALTIMESTAMP
LOCALTIMESTAMP()
Synonym for NOW().
MAKEDATE()Creates a date from the year and day of year.
MAKETIME()Creates time from hour, minute, second.
MICROSECOND()Extracts the microseconds from a given time or datetime expression.
MINUTE()Extracts the minute from a given time or datetime expression.
MONTH()Extracts the month from a given date.
MONTHNAME()Extracts the name of the month from a given date.
NOW()Returns the current date and time.
PERIOD_ADD()Adds a period to a year-month value.
PERIOD_DIFF()Returns the number of months between periods.
QUARTER()Returns the quarter from a given date expression.
SEC_TO_TIME()Converts seconds to ‘hh:mm:ss’ format.
SECOND()Returns the seconds (0-59) from a given time or datetime expression.
STR_TO_DATE()Converts a string to a date, datetime, or time value, based on a given format string.
SUBDATE()Subtracts an amount from a given date. Synonym for DATE_SUB() when invoked with three arguments.
SUBTIME()Subtracts a time value from another time value.
SYSDATE()Returns the time at which the function executes.
TIME()Extracts the time part of the time or datetime expression, and returns it as a string.
TIME_FORMAT()Formats a time value according to the given format string.
TIME_TO_SEC()Returns the time argument converted to seconds.
TIMEDIFF()Returns the difference between two time or datetime values. It subtracts the second time from the first.
TIMESTAMP()With a single argument, this function returns the date or datetime expression as a datetime value. With two arguments, it adds the time argument to the date or datetime argument, then returns the resulting datetime value.
TIMESTAMPADD()Adds an interval to a datetime expression.
TIMESTAMPDIFF()Returns the difference between two datetime expressions, based on a given unit.
TO_DAYS()Returns the date argument converted to days.
TO_SECONDS()Returns the date or datetime argument converted to seconds since Year 0.
UNIX_TIMESTAMP()Returns a Unix timestamp.
UTC_DATE()Returns the current UTC date.
UTC_TIME()Returns the current UTC time.
UTC_TIMESTAMP()Returns the current UTC date and time.
WEEK()Returns the week number from a given date or datetime expression.
WEEKDAY()Returns the weekday indexfrom a given date or datetime expression.
WEEKOFYEAR()Returns the calendar week of the date (1-53) from a given date or datetime expression.
YEAR()Returns the year from a given date or datetime expression.
YEARWEEK()Returns the year and week from a given date or datetime expression.