DateAdd Function

DateAdd lisää määrätyn aikajakson tietyn monikerran annettuun päivämäärään ja tulostaa lasketun päivämäärän.

Syntaksi:

DateAdd (Add, Count, Date)

Palautusarvo:

Variant-yleismuuttuja, jossa on päivämäärä.

Parametrit:

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

Jakso1 (merkkijono)

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


Count - A numerical expression specifying how often the Add interval will be added (Count is positive) or subtracted (Count is negative).

Date - A given date or the name of a Variant variable containing a date. The Add value will be added Count times to this value.

Esimerkki:

Sub example_dateadd

    MsgBox DateAdd("m", 1, "1/31/2004") &" - "& DateAdd("m", 1, "1/31/2005")

End Sub