DatePart (interval As String, date As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Long
Grąžinama reikšmė:
The extracted part for the given date.
Parametrai:
interval - A string expression from the following table, specifying the date interval.
interval (string value)
Paaiškinimas
yyyy
Metai
q
Ketvirtis
m
Mėnuo
y
Metų diena
w
Savaitės diena
ww
Metų savaitė
d
Diena
h
Valanda
n
Minutė
s
Sekundė
date - The date from which the result is calculated.
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#
firstdayofweek: An optional parameter that specifies the starting day of a week.
firstdayofweek value
Paaiškinimas
0
Naudoti numatytąją sistemos reikšmę
1
Sekmadienis (numatyta)
2
Pirmadienis
3
Antradienis
4
Trečiadienis
5
Ketvirtadienis
6
Penktadienis
7
Šeštadienis
firstweekofyear: An optional parameter that specifies the starting week of a year.
firstweekofyear value
Paaiškinimas
0
Naudoti numatytąją sistemos reikšmę
1
Pirmoji savaitė yra sausio mėnesį, 1st (numatyta)
2
„Week 1" yra pirmoji savaitė, kurioje keturios ar daugiau šių metų dienų
3
„Week 1" yra pirmoji savaitė, kurioje yra tik naujųjų metų dienos
Pavyzdys:
Sub example_datepart
MsgBox DatePart("ww", #01/02/2005#) ' displays 2 because weeks start on Sunday
MsgBox DatePart("ww", #12/31/2005#) ' displays 53
MsgBox DatePart(date:=#2005-12-30#, interval:="q") ' displays 4
End Sub