MySQL Date & Time Functions (Full List)

The following is a list of date and time functions available in MySQL. 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.
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 date as specified.
DATE_SUB()Subtracts a time value (interval) from a date.
DATEDIFF()Subtracts two dates.
DAY()Synonym for DAYOFMONTH().
DAYNAME()Returns the name of the weekday.
DAYOFMONTH()Returns the day of the month (0-31).
DAYOFWEEK()Returns the weekday index of the argument.
DAYOFYEAR()Returns the day of the year (1-366).
EXTRACT()Extracts part of a date.
FROM_DAYS()Converts a day number to a date.
FROM_UNIXTIME()Formats a Unix timestamp as a date.
GET_FORMAT()Returns a date format string.
HOUR()Extracts the hour from a given time or datetime expression.
LAST_DAY()Returns the last day of the month from the given date.
LOCALTIME()
LOCALTIME
Synonym for NOW().
LOCALTIMESTAMP()
LOCALTIMESTAMP
Synonym for NOW().
MAKEDATE()Creates a date from the year and day of year.
MAKETIME()Creates a time from the various time parts (i.e. hours, minutes, seconds).
MICROSECOND()Returns the microseconds from argument.
MINUTE()Returns the minute from the argument.
MONTH()Returns the month from the date passed.
MONTHNAME()Returns the name of the month.
NOW()Returns the current date and time.
PERIOD_ADD()Adds a period to a year-month.
PERIOD_DIFF()Returns the number of months between periods.
QUARTER()Returns the quarter from a date argument.
SEC_TO_TIME()Converts seconds to hh:mm:ss format.
SECOND()Returns the seconds part (0-59) from its argument.
STR_TO_DATE()Converts a string to a date.
SUBDATE()Synonym for the DATE_SUB() function 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 portion of the expression passed.
TIME_FORMAT()Formats a time value according to the given format string.
TIME_TO_SEC()Returns its 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; with two arguments, the sum of the arguments.
TIMESTAMPADD()Adds an interval to a datetime expression.
TIMESTAMPDIFF()Subtracts an interval from a datetime expression.
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 based on the given date/time value or the current date/time.
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 the specified date.
WEEKDAY()Returns the weekday index from the specified date.
WEEKOFYEAR()Returns the calendar week (1-53) of the specified date.
YEAR()Returns the year from the specified date.
YEARWEEK()Returns the year and week from the specified date.