DateAdd Function

Добавляет интервал дат к заданной дате несколько раз и возвращает результирующую дату.

Синтаксис


DateAdd (Добавить, Количество, Дата)

Возвращаемое значение:

Variant содержит дату.

Параметры:

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

Добавить (значение строки)

Описание

yyyy

Год

q

Квартал

m

Месяц

y

День года

w

День недели

ww

Неделя года

d

День

h

Час

n

Минута

s

Секунда


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.

Пример:


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

Please support us!