Date/Time Functions

Function Description
CURRENT_DATE Today's date.
CURRENT_TIME The current time.
CURRENT_TIMESTAMP The current date and time.
DATE_ADD(DATE [field name] datefield, [number] x) Adds x days to the values in the field named datefield.
DATE_ADD(DATE [literal string] giventime, [number] x) Adds x days to giventime.
DATE_ADD(DATE or TIME or TIMESTAMP [field name] timetypefield, [timeinterval] giveninterval) Adds giveninterval to the values in the field named timetypefield.
DATE_ADD(DATE or TIME or TIMESTAMP [literal string] giventime, [timeinterval] giveninterval) Adds giveninterval to giventime.
DATE_PART([literal string] timeunit, [timetype] giventime) Returns the number in giventime corresponding to the unit specified by timeunit. timeunit has possible values 'second', 'minute', 'hour', 'day', 'month', 'year'.
DATE_SUB(DATE [field name] datefield, [number] x) Subtracts x days from the values in the field named datefield.
DATE_SUB(DATE [literal string] giventime, [number] x) Subtracts x days from giventime.
DATE_SUB(DATE or TIME or TIMESTAMP [field name] timetypefield, [timeinterval] giveninterval) Subtracts giveninterval from the values in the field named timetypefield.
DATE_SUB(DATE or TIME or TIMESTAMP [literal string] giventime, [timeinterval] giveninterval) Subtracts giveninterval from giventime.
DATE_TRUNC([literal string] timeunit, [timetype] giventime) Truncates the precision of giventime to the unit given in timeunit.
EXTRACT(< time unit> FROM [timetype] giventime) Returns the number in giventime corresponding to the specified unit.
ISDATE([string] giventext) Returns true if giventext is castable to a date of format 'YYYY-MM-DD'.
LOCALTIME The current time.
LOCALTIMESTAMP The current date and time.
NOW() Returns the current date and time.
TIMEOFDAY() Returns a string of the date and time as well as the name of the time zone.
TIMESTAMPADD(< time unit>, [number] count, [timetype] giventime) Adds count units of < time unit> to the giventime.
TIMESTAMPDIFF(< time unit>, [timetype] giventime1, [timetype] giventime2) Returns the count units of time between giventime1 and giventime2, by subtracting giventime1 from giventime2 (rounded down).
UNIX_TIMESTAMP() Gives the current Unix time in seconds.
UNIX_TIMESTAMP([string] timestring, [string] format) Gives the Unix time for the date in timestring using the format specified in format.
UNIX_TIMESTAMP([string] timestring) Gives the Unix time for the date in timestring assuming a format of 'YYYY-MM-DD HH24:MI:SS'.

results matching ""

    No results matching ""