DatePart(
     date:date,
     string:part
)
string

Arguments

date

Date you want a part of.

part

Part you want. Date parts are:

dDay of month, no leading zero
ddDay of month, leading zero
DDay of week (1 = Sunday)
DDDay of week as a number (1 = Monday)
dddDay of week short name (e.g. Wed)
ddddDay of week long name (e.g. Wednesday)
wISO week, no leading zero
wwISO week, leading zero
WSimple week, no leading zero
WWSimple week, leading zero
MMonth, no leading zero
MMMonth, leading zero
MMMMonth short name (e.g. Jan)
MMMMMonth long name (e.g. January)
yYear last two digits, no leading zero
yyYear last two digits, leading zero
yyyyYear
YISO year last two digits, no leading zero
YYISO year last two digits, leading zero
YYYYISO year
ggPeriod/era string

Time parts are:

hHours, no leading zero, 12 hour clock
hhHours, leading zero, 12 hour clock
HHours, no leading zero, 24 hour clock
HHHours, leading zero, 24 hour clock
mMinutes, no leading zero
mmMinutes, leading zero
sSeconds, no leading zero
ssSeconds, leading zero
tOne-character AM/PM (e.g. A or P)
ttMultiple-character AM/PM%0

You can also specify date and time to retrieve the full date without the time, or full time without the date.

Return value

Requested part of the specified date.

Description

Returns the value of the specified part.

Example:

Output(DatePart("2006-01-01", "yy"))
--> 06