Database Reference
In-Depth Information
Function name
Usage
Return type
IF
To test an expression and then produce the result Argument
ISNULL
To test if an expression is
NULL
or not
Argument
Besides these, the other conditional functions are
NV1
and
CASE
. Now it is time to
learn a few of the date/time-specific functions, as in the following table:
Return
type
Function name
Usage
NOW()
To return the current date and time in UTC
TIMESTAMP
TO_DATE(STRING
date)
To convert a date string to a
TIMESTAMP
value
TIMESTAMP
YEAR(STRING
date)
To return the year value from a string date type
INT
DATEDIFF(date1,
date2)
To return the number of days between two dates
passed as arguments
INT
Other date and time functions not described previously are
DATE_ADD
,
DATE_SUB
,
DAY
,
DAYNAME
,
DAYOFWEEK
,
FROM_UNIXTIME
,
FROM_UTC_TIMESTAMP
,
HOUR
,