DatePart Function

DatePart ํ•จ์ˆ˜๋Š” ๋‚ ์งœ์˜ ํŠน์ • ๋ถ€๋ถ„์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

Syntax:


DatePart (interval As String, date As Date [, firstDayOfWeek As Integer [, firstWeekOfYear As Integer]]) As Long

๋ฐ˜ํ™˜ ๊ฐ’:

The extracted part for the given date.

Parameters:

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:

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์ž…๋‹ˆ๋‹ค.


Example:


Sub example_datepart
    MsgBox DatePart("ww", #12/31/2005#)
    MsgBox DatePart(date:=#1999-12-30#, interval:="q")
End Sub

Please support us!