EXTRACT
Pulls a single part out of a date or time: the year, month, day, hour.
Syntax
EXTRACT(<field> FROM <date or time>)
Returns a number: YEAR — the year, MONTH — the month from 1 to 12, DAY — the day of the month, HOUR — the hour, DOW — the day of the week. The field is written without quotes. Handy for filtering or grouping by part of a date: orders before noon, sales by hour.