DatePart Function
DatePart-funktio palauttaa pÀivÀmÀÀrÀstÀ mÀÀrÀtyn osan.
DatePart (interval As String, date As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Long
Palautusarvo:
The extracted part for the given date.
interval - A string expression from the following table, specifying the date interval.
interval (string value)
|
Selitys
|
yyyy
|
Vuosi
|
q
|
neljÀnnesvuosi
|
m
|
Kuukausi
|
y
|
(Vuoden) pÀivÀ
|
w
|
ViikonpÀivÀ
|
ww
|
Vuoden viikkonumero
|
d
|
PÀivÀ
|
h
|
tunti
|
n
|
minuutti
|
s
|
sekunti
|
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
|
Selitys
|
0
|
kÀyttöjÀrjestelmÀn oletusarvo
|
1
|
sunnuntai (oletus)
|
2
|
maanantai
|
3
|
tiistai
|
4
|
keskiviikko
|
5
|
torstai
|
6
|
perjantai
|
7
|
lauantai
|
firstweekofyear: An optional parameter that specifies the starting week of a year.
firstweekofyear value
|
Selitys
|
0
|
kÀyttöjÀrjestelmÀn oletusarvo
|
1
|
viikolla, johon kuuluu 1. tammikuuta, on viikkonumero 1 (oletus)
|
2
|
vuoden ensimmÀisellÀ sellaisella viikolla, jossa on pÀiviÀ neljÀ tai enemmÀn, on viikkonumero 1
|
3
|
vuoden ensimmÀinen kokonainen viikko, jossa on vain uuden vuoden pÀiviÀ, saa viikkonumero 1:n
|
Sub example_datepart
MsgBox DatePart("ww", #12/31/2005#)
MsgBox DatePart(date:=#1999-12-30#, interval:="q")
End Sub