MariaDB Date Functions

This page provides you with the most commonly used MariaDB date functions.

FunctionDescription
curdate()return the current date of the server on which the MariaDB Server runs
datediff()return the number of days between two dates
day()return the day of the month of a date
date_add()add an interval to a date
date_sub()subtract an interval from a date
date_format()return a date formatted by a specific format
dayname()return the weekday name of a date
dayofweek()return the weekday index of a date
extract()extract a component e.g., day, month, and year from a date
last_day()return the last day of the month of a date
now()return the current date and time at which the SQL command executes
month()return an integer that represents a month of a date
str_to_date()return a date converted from a string
sysdate()return the current date
timediff()return the difference between the two time values or datetime values
timestampdiff()return the difference between two timestamps
week()return the week number of a date
weekday()return the weekday of a date
year()return the year of a date