AddDate()
语法
Date = AddDate(Date, Type, Value)概要
Add an amount of time to a date.
参数
Date The date value to which the value should be added. Type The value type. It can be one of the following constants: #PB_Date_Year : Will add 'Value' Years to the date #PB_Date_Month : Will add 'Value' Months to the date #PB_Date_Week : Will add 'Value' Weeks to the date #PB_Date_Day : Will add 'Value' Days to the date #PB_Date_Hour : Will add 'Value' Hours to the date #PB_Date_Minute : Will add 'Value' Minutes to the date #PB_Date_Second : Will add 'Value' Seconds to the dateNote: when #PB_Date_Month is used, it will automatically account for the fact that the numbers of days per month varies, for example: if a month is added to '31 march 2008' the result will be '30 april 2008', since april does not have 31 days.Value The value to add to the date. A negative value can be used to subtract a date.
返回值
Returns the new date.
示例
Debug FormatDate("%yyyy/%mm/%dd", AddDate(Date(), #PB_Date_Year, 2)) ; Returns the current date + 2 years Debug FormatDate("%mm/%dd/%yyyy", AddDate(Date(), #PB_Date_Year, 2)) ; Returns the current date + 2 years
参阅
Date(), FormatDate()
已支持操作系统
所有