First page Back Continue Last page Image

Extracting Date and Time from Date Type Fields

DAYOFMONTH(date)

MONTH(date)

YEAR(date)

HOUR(time)

MINUTE(time)

SECOND(time)

DAYOFWEEK(date)

 

QUARTER(date)

DAYOFYEAR(date)

WEEK(date[,first])

 

LAST_DAY(date)

 

DAYNAME(date)

MONTHNAME(date)

All of these functions are available to extract parts of a Date and or Time out of a DATE type field in a Database

This is different than what we did earlier in the class, the earlier extraction using SUBSTRING was because the date and time was in a string field