Syntax
EXTRACT(unit FROM date)
Purpose
Returns the value of the specified part of the date in integer type. If multiple parts are specified, all values are concatenated in order.
For more information about the unit parameter, see DATE_ADD. When unit is WEEK, the first day of the week is Sunday.
Examples
obclient> SELECT EXTRACT(WEEK FROM '2013-01-01'),
EXTRACT(WEEK FROM '2013-01-06'),
EXTRACT(YEAR_MONTH FROM '2012-03-09'),
EXTRACT(DAY FROM NOW())\G;
*************************** 1. row ***************************
EXTRACT(WEEK FROM '2013-01-01'): 0
EXTRACT(WEEK FROM '2013-01-06'): 1
EXTRACT(YEAR_MONTH FROM '2012-03-09'): 201203
EXTRACT(DAY FROM NOW()): 16
1 row in set
