Database Reference
In-Depth Information
Figure 11.9
HOUR(), MINUTE() and SECOND().
Figure 11.9 shows this function running along with some other time functions.
MINUTE
MINUTE() returns the minutes past the hour for a given time object. You pass the time
value to it as follows:
MINUTE( aTime )
To obtain the current minute past the hour, we can use the following:
SELECT MINUTE( NOW() )
Figure 11.9 shows this query in action.
SECOND
SECOND() returns the seconds in the minute of a given time object. You pass the time value
to it as follows:
SECOND( aTime )
To obtain the seconds part of the current time, we can use the following:
SELECT SECOND( NOW() )
Figure 11.9 shows the results for this at the time of writing.
DATE_ADD
There is no real need to add dates together, however adding a period of time to a date is use-
ful. The DATE_ADD() function allows you to add a time period to a date. The format of
DATE_ADD() is as follows:
DATE_ADD( aDate, INTERVAL timeperiod )
Search WWH ::




Custom Search