DateAdd Function

Pridá dátumový interval k zadanému dátumu daný počet krát a vráti výsledný dátum.

Syntax:

DateAdd (Add, Count, Date)

Návratová hodnota:

Premenná typu variant obsahujúca dátum.

Paremetre:

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

Pridaj (reťazcovú hodnotu)

Vysvetlenie

yyyy

Rok

q

Štvrtina

m

Mesiac

y

Deň v mesiaci

w

Pracobný deň

ww

Týždeň v roku

d

Deň

h

Hodina

n

Minúta

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.

Príklad:

Sub example_dateadd

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

End Sub