2gQJj‖
FZMy8‖DatePart Function
i4c5k‖The DatePart function returns a specified part of a date.
GWMCJ‖DatePart (interval As String, date As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Long
wi5B9‖Return value:
V53FC‖The extracted part for the given date.
4Dk4X‖ interval - A string expression from the following table, specifying the date interval.
yKYH5‖interval (string value)
|
BrkDy‖Explanation
|
QCaFK‖yyyy
|
uCMGD‖Year
|
BTQbh‖q
|
aAbFF‖Quarter
|
khy6d‖m
|
DnwYQ‖Month
|
2kcLi‖y
|
5ceAL‖Day of year
|
gDYqD‖w
|
zMz7B‖Weekday
|
SGGGX‖ww
|
Wknbt‖Week of year
|
AodTF‖d
|
QUMAr‖Day
|
DtMSq‖h
|
bW8VY‖Hour
|
EFdrN‖n
|
E7sMZ‖Minute
|
gpxE5‖s
|
saACB‖Second
|
KDtSw‖ date - The date from which the result is calculated.
5FGDA‖Date literals allow to specify unambiguous date variables that are independent from the current language. Literals are enclosed between hash signs #. Possible formats are:
-
#yyyy-mm-dd#
-
#mm/dd/yyyy#
hjbSu‖ firstdayofweek: An optional parameter that specifies the starting day of a week.
wpCoP‖firstdayofweek value
|
gmaR8‖Explanation
|
A5RkW‖0
|
Xt9Xx‖Use system default value
|
6UMdD‖1
|
uV8iz‖Sunday (default)
|
zuFMX‖2
|
vUz3C‖Monday
|
2YAp3‖3
|
KCW5A‖Tuesday
|
8rkEA‖4
|
hhEsB‖Wednesday
|
3F47C‖5
|
Zv7Dn‖Thursday
|
aP5Bd‖6
|
EbThD‖Friday
|
CmnqZ‖7
|
BjBfG‖Saturday
|
UFDDA‖ firstweekofyear: An optional parameter that specifies the starting week of a year.
e3gQd‖firstweekofyear value
|
zAFFS‖Explanation
|
XEzpc‖0
|
jXczC‖Use system default value
|
sqUf8‖1
|
65vhA‖Week 1 is the week with January, 1st (default)
|
7KXnC‖2
|
wFZe8‖Week 1 is the first week containing four or more days of that year
|
85UKo‖3
|
xAkGk‖Week 1 is the first week containing only days of the new year
|
Sub example_datepart
MsgBox DatePart("ww", #12/31/2005#)
MsgBox DatePart(date:=#1999-12-30#, interval:="q")
End Sub