DatePart Function

La funkcio DatePart liveras specifitan parton el dato.

Syntax:


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

Liverota valoro:

The extracted part for the given date.

Parameters:

interval - A string expression from the following table, specifying the date interval.

interval (string value)

Klarigo

yyyy

Jaro

q

Kvaronjaro

m

Monato

y

Tago de la jaro

w

Semajntago

ww

Semajno de la jaro

d

Tago

h

Horo

n

Minuto

s

Sekundo


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

Klarigo

0

Uzu sisteman aprioran valoron

1

Dimanĉe (apriora)

2

Lunde

3

Marde

4

Merkrede

5

Ĵaŭde

6

Vendrede

7

Sabate


firstweekofyear: An optional parameter that specifies the starting week of a year.

firstweekofyear value

Klarigo

0

Uzu sisteman aprioran valoron

1

Semajno 1 estas la semajno kiu enhavas la unuan de januaro (apriora)

2

Semajno 1 estas la unua semajno de la jaro kiu enhavas kvar aŭ pliajn tagojn

3

Semajno 1 estas la unua semajno kiu enhavas nur tagojn de la nova jaro


Example:


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

Bonvolu subteni nin!