MySQL日期函数

时间:2019-11-20 08:52:21  来源:igfitidea点击:

本页显示最常用的MySQL Date函数,可让您有效地操作日期和时间数据。

FunctionDescription
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