DateAdd 函数
向指定日期多次添加日期间隔并返回生成的日期。
语法:
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