DatePart Function
DatePart ํจ์๋ ๋ ์ง์ ํน์ ๋ถ๋ถ์ ๋ฐํํฉ๋๋ค.
DatePart (interval As String, date As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Long
๋ฐํ ๊ฐ:
The extracted part for the given date.
interval - A string expression from the following table, specifying the date interval.
interval (string value)
|
์ค๋ช
|
yyyy
|
์ฐ๋
|
q
|
๋ถ๊ธฐ
|
m
|
์
|
y
|
์ผ
|
w
|
์์ผ
|
ww
|
์ฃผ
|
d
|
๋ ์ง
|
h
|
์
|
n
|
๋ถ
|
s
|
์ด
|
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
|
์ค๋ช
|
0
|
์์คํ
๊ธฐ๋ณธ๊ฐ ์ฌ์ฉ
|
1
|
์ผ์์ผ(๊ธฐ๋ณธ๊ฐ)
|
2
|
์์์ผ
|
3
|
ํ์์ผ
|
4
|
์์์ผ
|
5
|
๋ชฉ์์ผ
|
6
|
๊ธ์์ผ
|
7
|
ํ ์์ผ
|
firstweekofyear: An optional parameter that specifies the starting week of a year.
firstweekofyear value
|
์ค๋ช
|
0
|
์์คํ
๊ธฐ๋ณธ๊ฐ ์ฌ์ฉ
|
1
|
1์ 1์ผ์ด ํฌํจ๋ ์ฃผ(๊ธฐ๋ณธ๊ฐ)๊ฐ ์ฃผ 1์
๋๋ค.
|
2
|
ํด๋น ์ฐ๋์ 4์ผ ์ด์์ด ํฌํจ๋ ์ฒซ์งธ ์ฃผ๊ฐ ์ฃผ 1์
๋๋ค.
|
3
|
์๋ก์ด ์ฐ๋์ ๋ ์ง๋ง ํฌํจ๋ ์ฒซ์งธ ์ฃผ๊ฐ ์ฃผ 1์
๋๋ค.
|
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