DATEPART

Description

Returns the specified part of a given date.

Syntax

DATEPART ( interval, date )

Parameter Description
interval String expression that is the interval of time to add. Interval can be one of the following values:
  • yyyy — Year
  • q — Quarter
  • m — Month
  • y — Day of year
  • d — Day
  • w — Weekday
  • ww — Week
  • h — Hour
  • n — Minute
  • s — Second
date Date to be evaluated.

Remarks

Use the DATEPART function to evaluate a date and return a specific interval of time. For example, use DATEPART to calculate the day of the week or the current hour.