DateAdd Function

在指定日期中多次增加日期間隔,並傳回結果日期。

語法


DateAdd (Add, Count, Date)

傳回值類型

包含日期的變體。

參數:

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

Add (字串值)

說明

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!