SQL
- Date and Time Functions
Name
|
Description
|
ADDDATE()
|
Adds dates
|
ADDTIME()
|
Adds time
|
CONVERT_TZ()
|
Converts from one timezone to another
|
CURDATE()
|
Returns the current date
|
CURRENT_DATE(), CURRENT_DATE
|
Synonyms for CURDATE()
|
CURRENT_TIME(), CURRENT_TIME
|
Synonyms for CURTIME()
|
CURRENT_TIMESTAMP(),
CURRENT_TIMESTAMP
|
Synonyms for NOW()
|
CURTIME()
|
Returns the current time
|
DATE_ADD()
|
Adds two dates
|
DATE_FORMAT()
|
Formats date as specified
|
DATE_SUB()
|
Subtracts two dates
|
DATE()
|
Extracts the date part of a date or datetime expression
|
DATEDIFF()
|
Subtracts two dates
|
DAY()
|
Synonym for DAYOFMONTH()
|
DAYNAME()
|
Returns the name of the weekday
|
DAYOFMONTH()
|
Returns the day of the month (1-31)
|
DAYOFWEEK()
|
Returns the weekday index of the argument
|
DAYOFYEAR()
|
Returns the day of the year (1-366)
|
EXTRACT
|
Extracts part of a date
|
FROM_DAYS()
|
Converts a day number to a date
|
FROM_UNIXTIME()
|
Formats date as a UNIX timestamp
|
HOUR()
|
Extracts the hour
|
LAST_DAY
|
Returns the last day of the month for the argument
|
LOCALTIME(), LOCALTIME
|
Synonym for NOW()
|
LOCALTIMESTAMP,
LOCALTIMESTAMP()
|
Synonym for NOW()
|
MAKEDATE()
|
Creates a date from the year and day of year
|
MAKETIME
|
MAKETIME()
|
MICROSECOND()
|
Returns the microseconds from argument
|
MINUTE()
|
Returns the minute from the argument
|
MONTH()
|
Return the month from the date passed
|
MONTHNAME()
|
Returns the name of the month
|
NOW()
|
Returns the current date and time
|
PERIOD_ADD()
|
Adds a period to a year-month
|
PERIOD_DIFF()
|
Returns the number of months between periods
|
QUARTER()
|
Returns the quarter from a date argument
|
SEC_TO_TIME()
|
Converts seconds to 'HH:MM:SS' format
|
SECOND()
|
Returns the second (0-59)
|
STR_TO_DATE()
|
Converts a string to a date
|
SUBDATE()
|
When invoked with three arguments a synonym for DATE_SUB()
|
SUBTIME()
|
Subtracts times
|
SYSDATE()
|
Returns the time at which the function executes
|
TIME_FORMAT()
|
Formats as time
|
TIME_TO_SEC()
|
Returns the argument converted to seconds
|
TIME()
|
Extracts the time portion of the expression passed
|
TIMEDIFF()
|
Subtracts time
|
TIMESTAMP()
|
With a single argument, this function returns the date or datetime
expression. With two arguments, the sum of the arguments
|
TIMESTAMPADD()
|
Adds an interval to a datetime expression
|
TIMESTAMPDIFF()
|
Subtracts an interval from a datetime expression
|
TO_DAYS()
|
Returns the date argument converted to days
|
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 (1-53)
|
YEAR()
|
Returns the year
|
YEARWEEK()
|
Returns the year and week
|
0 comments:
Post a Comment