MySQL Date Functions

Created with Sketch.

MySQL Date Functions

This page shows you the most commonly used MySQL Date functions that allow you to manipulate date and time data effectively.

CURDATEReturns the current date.
DATEDIFFCalculates the number of days between two DATE values.
DAYGets the day of the month of a specified date.
DATE_ADDAdds a time value to date value.
DATE_SUBSubtracts a time value from a date value.
DATE_FORMATFormats a date value based on a specified date format.
DAYNAMEGets the name of a weekday for a specified date.
DAYOFWEEKReturns the weekday index for a date.
EXTRACTExtracts a part of a date.
LAST_DAYReturns the last day of the month of a specified date
NOWReturns the current date and time at which the statement executed.
MONTHReturns an integer that represents a month of a specified date.
STR_TO_DATEConverts a string into a date and time value based on a specified format.
SYSDATEReturns the current date.
TIMEDIFFCalculates the difference between two TIME or DATETIME values.
TIMESTAMPDIFFCalculates the difference between two DATE or DATETIME values.
WEEKReturns a week number of a date.
WEEKDAYReturns a weekday index for a date.
YEARReturn the year for a specified date

Leave a Reply

Your email address will not be published. Required fields are marked *