DateAdd Function

Określoną ilość razy dodaje interwał do daty i zwraca utworzoną w ten sposób datę.

Składnia:

DateAdd (dodaj, ilość, data)

Zwracana wartość:

Zmienna typu Variant zawierajÄ…ca datÄ™.

Parametry:

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

Dodaj (wartość w postaci ciągu)

Znaczenie

yyyy

Rok

q

Kwartał

m

MiesiÄ…c

y

Dzień roku

w

Dzień tygodnia

ww

Tydzień roku

d

Dzień

h

Godzina

n

Minuta

s

Sekunda


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.

Przykład:

Sub example_dateadd

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

End Sub