extract

Returns an integer representing the value of datepart (year, month, day, hour, minute, second) in "datetime_expression".

Syntax

extract ( datepart , datetime_expression )

Example 1

extract ( year , 2003-03-03 16:40:15.535 )

Result

2003

Example 2

extract ( hour , 2003-03-03 16:40:15.535 )

Result

16