DATEPART

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

For example, if you wanted the value of the month for a date, you might 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, yy, yyyy
    • quarter, q, qq
    • month, m, mm
    • week, wk, ww
    • day, d, dd
    • weekday, dw
    • dayofyear, dy, y
    • hour, hh
    • minute, mm, n
    • second, ss, s
    • millisecond, ms
  • date references the date for which you want to return the part value.