Jump to: navigation, search

MySQL Date and Time Functions

From w3cyberlearnings
# Function Description
1 ADDDATE Add time values (intervals) to a date value
2 ADDTIME Add time
3 CONVERT_TZ Convert from one timezone to another
4 CURDATE Return the current date
5 CURRENT_DATE CURRENT_DATE Synonyms for CURDATE()
6 CURRENT_TIME CURRENT_TIME Synonyms for CURTIME()
7 CURRENT_TIMESTAMP CURRENT_TIMESTAMP Synonyms for NOW()
8 CURTIME Return the current time
9 DATE_ADD Add time values (intervals) to a date value
10 DATE_FORMAT Format date as specified
11 DATE_SUB Subtract a time value (interval) from a date
12 DATE Extract the date part of a date or datetime expression
13 DATEDIFF Subtract two dates
14 DAY Synonym for DAYOFMONTH()
15 DAYNAME Return the name of the weekday
16 DAYOFMONTH Return the day of the month (0-31)
17 DAYOFWEEK Return the weekday index of the argument
18 DAYOFYEAR Return the day of the year (1-366)
19 EXTRACT Extract part of a date
20 FROM_DAYS Convert a day number to a date
21 FROM_UNIXTIME Format UNIX timestamp as a date
22 GET_FORMAT Return a date format string
23 HOUR Extract the hour
24 LAST_DAY Return the last day of the month for the argument
25 LOCALTIME LOCALTIME Synonym for NOW()
26 LOCALTIMESTAMP LOCALTIMESTAMP() Synonym for NOW()
27 MAKEDATE Create a date from the year and day of year
28 MAKETIME Make time
29 MICROSECOND Return the microseconds from argument
30 MINUTE Return the minute from the argument
31 MONTH Return the month from the date passed
32 MONTHNAME Return the name of the month
33 NOW Return the current date and time
34 PERIOD_ADD Add a period to a year-month
35 PERIOD_DIFF Return the number of months between periods
36 QUARTER Return the quarter from a date argument
37 SEC_TO_TIME Converts seconds to 'HH:MM:SS' format
38 SECOND Return the second (0-59)
39 STR_TO_DATE Convert a string to a date
40 SUBDATE A synonym for DATE_SUB() when invoked with three arguments
41 SUBTIME Subtract times
42 SYSDATE Return the time at which the function executes
43 TIME_FORMAT Format as time
44 TIME_TO_SEC Return the argument converted to seconds
45 TIME Extract the time portion of the expression passed
46 TIMEDIFF Subtract time
47 TIMESTAMP With a single argument, this function returns the date or datetime expression; with two arguments, the sum of the arguments
48 TIMESTAMPADD Add an interval to a datetime expression
49 TIMESTAMPDIFF Subtract an interval from a datetime expression
50 TO_DAYS Return the date argument converted to days
51 TO_SECONDS Return the date or datetime argument converted to seconds since Year 0
52 UNIX_TIMESTAMP Return a UNIX timestamp
53 UTC_DATE Return the current UTC date
54 UTC_TIME Return the current UTC time
55 UTC_TIMESTAMP Return the current UTC date and time
56 WEEK Return the week number
57 WEEKDAY Return the weekday index
58 WEEKOFYEAR Return the calendar week of the date (0-53)
59 YEAR Return the year
60 YEARWEEK Return the year and week



Related Links

Navigation
Web
SQL
MISC
References