MariaDB Data and Time Functions
This page organizes commonly used date and time functions in MariaDB.
-
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. -
ADDDATE()
In MariaDB, theADDDATE()
function adds the specified time interval to the specified date/time and returns the operation result. -
ADDTIME()
In MariaDB,ADDTIME()
is a built-in function that adds a specified time interval to a specified time and returns the result. -
CONVERT_TZ()
In MariaDB,CONVERT_TZ()
is a built-in function used to convert a datetime value from one time zone to another. -
CURDATE()
In MariaDB,CURDATE()
is a built-in function that returns the system’s current date inYYYY-MM-DD
orYYYYMMDD
format. -
CURRENT_DATE()
In MariaDB,CURRENT_DATE()
is a built-in function that returns the system’s current date inYYYY-MM-DD
orYYYYMMDD
format. -
CURRENT_TIME()
In MariaDB,CURRENT_TIME()
is a built-in function that returns the current time. -
CURRENT_TIMESTAMP()
In MariaDB,CURRENT_TIMESTAMP()
is a built-in function that returns the current date and time. -
CURTIME()
In MariaDB,CURTIME()
is a built-in function that returns the current time. -
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. -
DATE_FORMAT()
In MariaDB,DATE_FORMAT()
is a built-in function that formats a date/time according to a given format string. -
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. -
DATE()
In MariaDB,DATE()
is a built-in function that extracts date parts from the gaven datetime expression. -
DATEDIFF()
In MariaDB,DATEDIFF()
is a built-in function that returns the difference between two dates in days. -
DAY()
In MariaDB,DAY()
is a built-in function that returns the number representing the day of the month in a given datetime expression. -
DAYNAME()
In MariaDB,DAYNAME()
is a built-in function that returns the weekday name for a given date. -
DAYOFMONTH()
In MariaDB,DAYOFMONTH()
is a built-in function that returns a number representing the day of the month in a datetime expression. -
DAYOFWEEK()
In MariaDB,DAYOFWEEK()
is a built-in function that returns a number representing the weekday for a given date. -
DAYOFYEAR()
In MariaDB,DAYOFYEAR()
is a built-in function that returns a number representing the day of the year for a given date. -
EXTRACT()
In MariaDB,EXTRACT()
is a built-in function that extracts specified parts from a given date or datetime expression. -
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. -
FROM_UNIXTIME()
In MariaDB,FROM_UNIXTIME()
is a built-in function that converts a given unix timestamp to a datetime value. -
GET_FORMAT()
In MariaDB,GET_FORMAT()
is a built-in function that returns a formatted string according to the parameters. -
HOUR()
In MariaDB,HOUR()
is a built-in function that returns the hour part from a given time expression. -
LAST_DAY
In MariaDB,LAST_DAY
is a built-in function that returns the last day of the month for a given date. -
LOCALTIME()
In MariaDB,LOCALTIME()
is a built-in function that returns the current date and time. -
LOCALTIMESTAMP()
In MariaDB,LOCALTIMESTAMP()
is a built-in function that returns the current date and time. -
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. -
MAKETIME()
In MariaDB,MAKETIME()
is a built-in function that creates a time from given hours, minutes, and seconds. -
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. -
MINUTE()
In MariaDB,MINUTE()
is a built-in function that extracts and returns the minutes portion of a given time expression. -
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. -
MONTHNAME()
In MariaDB,MONTHNAME()
is a built-in function that returns the month name for a given date. -
NOW()
In MariaDB,NOW()
is a built-in function that returns the current date and time. -
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. -
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. -
QUARTER()
In MariaDB,QUARTER()
is a built-in function that returns the quarter from a given date expression. -
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. -
SECOND()
In MariaDB,SECOND()
is a built-in function that returns the seconds portion of a given time expression. -
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. -
SUBDATE()
In MariaDB,SUBDATE()
is a built-in function that subtracts a given time interval from a given date. -
SUBTIME()
In MariaDB,SUBTIME()
is a built-in function that subtracts a time from a time or datetime expression. -
SYSDATE()
In MariaDB,SYSDATE()
is a built-in function that returns the current date and time. -
TIME_FORMAT()
In MariaDB,TIME_FORMAT()
is a built-in function that formats a given time according to a given format. -
TIME_TO_SEC()
In MariaDB,TIME_TO_SEC()
is a built-in function that converts a given time value to seconds. -
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. -
TIMEDIFF()
In MariaDB,TIMEDIFF()
is a built-in function that returns the difference between two time or datetime values. -
TIMESTAMP()
In MariaDB,TIMESTAMP()
is a built-in function that sums all arguments and returns the result as a datetime value. -
TIMESTAMPADD()
In MariaDB,TIMESTAMPADD()
is a built-in function that adds the specified time interval to a datetime value and returns the result. -
TIMESTAMPDIFF()
In MariaDB,TIMESTAMPDIFF()
is a built-in function that returns the difference between two datetimes. -
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. -
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. -
UNIX_TIMESTAMP()
In MariaDB,UNIX_TIMESTAMP()
is a built-in function that converts a specified date/datetime to a UNIX timestamp value. -
UTC_DATE()
In MariaDB,UTC_DATE()
is a built-in function that returns the current UTC date. -
UTC_TIME()
In MariaDB,UTC_TIME()
is a built-in function that returns the current UTC time. -
UTC_TIMESTAMP()
In MariaDB,UTC_TIMESTAMP()
is a built-in function that returns the current UTC date and time. -
WEEK()
In MariaDB,WEEK()
is a built-in function that returns the week of the year for a given date. -
WEEKDAY()
In MariaDB,WEEKDAY()
is a built-in function that returns the weekday number for a given date. -
WEEKOFYEAR()
In MariaDB,WEEKOFYEAR()
is a built-in function that returns the week number for a given date. -
YEAR()
In MariaDB,YEAR()
is a built-in function that returns the year from a given date expression. -
YEARWEEK()
In MariaDB,YEARWEEK()
is a built-in function that returns the year and week number of a given date.