DATEPART

Returns a number indicating the value of a part of a date value for a specified date.

For example, if you want the value of the month for a date, you can get a return value of 10 (for October).

Note: This function is equivalent to DATEPART in T-SQL.

Return Value

Integer

Syntax

DATEPART( datePart, date )

where:

  • datePart is the part of the date for which you want to return the value. Possible values for this argument include these:
    • year - yyyy
    • month - m
    • week - ww
    • day - d
    • weekday - w
    • dayofyear - y
    • hour - h
    • minute - n
    • second - s
  • date references the date for which you want to return the part value.