MySQL日期函数
时间:2019-11-20 08:52:21 来源:igfitidea点击:
本页显示最常用的MySQL Date函数,可让您有效地操作日期和时间数据。
Function | Description |
---|---|
CURDATE | Returns the current date. |
DATEDIFF | Calculates the number of days between two DATE values. |
DAY | Gets the day of the month of a specified date. |
DATE_ADD | Adds a time value to date value. |
DATE_SUB | Subtracts a time value from a date value. |
DATE_FORMAT | Formats a date value based on a specified date format. |
DAYNAME | Gets the name of a weekday for a specified date. |
DAYOFWEEK | Returns the weekday index for a date. |
EXTRACT | Extracts a part of a date. |
LAST_DAY | Returns the last day of the month of a specified date |
NOW | Returns the current date and time at which the statement executed. |
MONTH | Returns an integer that represents a month of a specified date. |
STR_TO_DATE | Converts a string into a date and time value based on a specified format. |
SYSDATE | Returns the current date. |
TIMEDIFF | Calculates the difference between two TIME or DATETIME values. |
TIMESTAMPDIFF | Calculates the difference between two DATE or DATETIME values. |
WEEK | Returns a week number of a date. |
WEEKDAY | Returns a weekday index for a date. |
YEAR | Return the year for a specified date |