Functions Language

DatePart

The DatePart() function returns a part of a date.

Related functions: DateAdd

Syntax


Datepart (Part, Date)

Part

The part of the date to return. Possible values:

“doy” (day of year)

“dow” (day of week)

“d” (day)

“m” (month)

“y” (year)

Date Any date

Examples


Description Function Output
Return the year Datepart(“y”,”2015/03/20″) 2015
Return the day Datepart(“d”,”2015/03/20″) 20
Return the month Datepart(“m”,”2015/05/21″) 5
Return the day of the year Datepart(“doy”,”2015/05/21″) 141
Return the day of the week Datepart(“dow”,”2015/05/21″) 5