TIMEDIFF( )
Synopsis
This function returns the time difference between the two times given. Although the arguments may be given in time or date-and-time format, both arguments must be of the same datatype. This function is available as of Version 4.1.1 of MySQL.
TIME( )
Synopsis
This function returns the time from a given string or column containing date and time data. This function is available as of Version 4.1.1 of MySQL.
SYSDATE( )
Synopsis
This function returns the system date. It will return the date and time in ayyyy-mm-dd hh:mm:ss format, but will return the data in a yyyymmddformat if it's used as part of a numeric calculation. This function is an alias for the
NOW( )
function.
SUBTIME( )
Synopsis
This function returns the date and time for the given string or column, decreased by the time given as the second argument (d hh:mm:ss). If a negative number is given, the time is added and the function is the equivalent of
ADDTIME()
. This function is available as of Version 4.1.1 of MySQL.
Notice that the hour was decreased by one, and because the time is just after midnight, the function causes the date to be altered by one day, as well. To decrease the date, add the number of days before the time (separated by a space) like so:
SUBDATE( )
Synopsis
Use this function to subtract a time interval from the results of a
date
or time
datatype column. If a negative value is given, the interval is added and is equivalent to the ADDDATE( )
function. This is an alias for the DATE_SUB( )
function. See DATE_ADD( )
for a table of incremental types.
As of Version 4.1 of MySQL, for subtracting days the second argument of the function may simply be the number of days (i.e., just
1
instead of INTERVAL 1
DAY
).
This function returns the time difference between the two times given but only for the interval being compared. The intervals accepted are the same as those for the
TIMESTAMPADD( )
function. This function is available as of Version 5 of MySQL.
TIMESTAMP( )
Synopsis
This function returns date and time (in yyyy-mm-dd hh:mm:ss format) from a given string or column containing date and time data, respectively. If only the date or only the time is given, the function will return zeros for the missing parameters. This function is available as of Version 4.1.1 of MySQL.
0 comments:
Post a Comment