3
Date & Time Functions
MariaDB 101: Learning the Basics of MariaDB
Watch the WebinarFunctions for handling date and time, e.g. TIME, DATE, DAYNAME etc.
-
Microseconds in MariaDB
Microseconds have been supported since MariaDB 5.3. -
Date and Time Units
Date or time units -
ADD_MONTHS
Adds a number of months to a date. -
ADDDATE
Add days or another interval to a date. -
ADDTIME
Adds a time to a time or datetime. -
CONVERT_TZ
Converts a datetime from one time zone to another. -
CURDATE
Returns the current date. -
CURRENT_DATE
Synonym for CURDATE(). -
CURRENT_TIME
Synonym for CURTIME(). -
CURRENT_TIMESTAMP
Synonym for NOW(). -
CURTIME
Returns the current time. -
DATE FUNCTION
Extracts the date portion of a datetime. -
DATEDIFF
Difference in days between two date/time values. -
DATE_ADD
Date arithmetic - addition. -
DATE_FORMAT
Formats the date value according to the format string. -
DATE_SUB
Date arithmetic - subtraction. -
DAY
Synonym for DAYOFMONTH(). -
DAYNAME
Return the name of the weekday. -
DAYOFMONTH
Returns the day of the month. -
DAYOFWEEK
Returns the day of the week index. -
DAYOFYEAR
Returns the day of the year. -
EXTRACT
Extracts a portion of the date. -
FORMAT_PICO_TIME
Given a time in picoseconds, returns a human-readable time value and unit indicator. -
FROM_DAYS
Returns a date given a day. -
FROM_UNIXTIME
Returns a datetime from a Unix timestamp. -
GET_FORMAT
Returns a format string. -
HOUR
Returns the hour. -
LAST_DAY
Returns the last day of the month. -
LOCALTIME
Synonym for NOW(). -
LOCALTIMESTAMP
Synonym for NOW(). -
MAKEDATE
Returns a date given a year and day. -
MAKETIME
Returns a time. -
MICROSECOND
Returns microseconds from a date or datetime. -
MINUTE
Returns a minute from 0 to 59. -
MONTH
Returns a month from 1 to 12. -
MONTHNAME
Returns the full name of the month. -
NOW
Returns the current date and time. -
PERIOD_ADD
Add months to a period. -
PERIOD_DIFF
Number of months between two periods. -
QUARTER
Returns year quarter from 1 to 4. -
SECOND
Returns the second of a time. -
SEC_TO_TIME
Converts a second to a time. -
STR_TO_DATE
Converts a string to date. -
SUBDATE
Subtract a date unit or number of days. -
SUBTIME
Subtracts a time from a date/time. -
SYSDATE
Returns the current date and time. -
TIME Function
Extracts the time. -
TIMEDIFF
Returns the difference between two date/times. -
TIMESTAMP FUNCTION
Return the datetime, or add a time to a date/time. -
TIMESTAMPADD
Add interval to a date or datetime. -
TIMESTAMPDIFF
Difference between two datetimes. -
TIME_FORMAT
Formats the time value according to the format string. -
TIME_TO_SEC
Returns the time argument, converted to seconds. -
TO_DAYS
Number of days since year 0. -
TO_SECONDS
Number of 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. -
WEEKDAY
Returns the weekday index. -
WEEKOFYEAR
Returns the calendar week of the date as a number in the range from 1 to 53. -
YEAR
Returns the year for the given date. -
YEARWEEK
Returns year and week for a date.
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.