DatePart funktsioon
Funktsioon DatePart tagastab kuupÀeva mÀÀratud osa.
DatePart (interval As String, date As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Long
TagastusvÀÀrtus:
The extracted part for the given date.
interval - A string expression from the following table, specifying the date interval.
interval (string value)
|
Selgitus
|
yyyy
|
Aasta
|
q
|
Kvartal
|
m
|
Kuu
|
y
|
PĂ€ev aastas
|
w
|
NÀdalapÀev
|
ww
|
NĂ€dal aastas
|
d
|
PĂ€ev
|
h
|
Tund
|
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
|
Selgitus
|
0
|
Kasutatakse sĂŒsteemi vaikevÀÀrtust
|
1
|
PĂŒhapĂ€ev (vaikimisi)
|
2
|
EsmaspÀev
|
3
|
TeisipÀev
|
4
|
KolmapÀev
|
5
|
NeljapÀev
|
6
|
Reede
|
7
|
LaupÀev
|
firstweekofyear: An optional parameter that specifies the starting week of a year.
firstweekofyear value
|
Selgitus
|
0
|
Kasutatakse sĂŒsteemi vaikevÀÀrtust
|
1
|
NÀdal 1 on nÀdal, mis sisaldab kuupÀeva 1. jaanuar (vaikimisi)
|
2
|
NÀdal 1 on nÀdal, mis sisaldab aasta nelja vÔi enamat pÀeva.
|
3
|
NÀdal 1 on nÀdal, mis sisaldab ainult alanud aasta pÀevi.
|
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