IncMonth

Top  Previous  Next

function IncMonth(Value As DateTime, IncValue As Integer) As DateTime

 

Returns a date shifted by a specified number of months.

 

IncValue can be negative, to return a date N months previous.

 

If the input day of month is greater than the last day of the resulting month, the day is set to the last day of the resulting month. The time of day specified by the Date parameter is copied to the result.

 

To increase/decrease a date by a specified number of days, you can use a +/- operation:

 

= d + 3 ' increment d by 3 days
= d - 1 ' decrement d by 1 day

 

Parameters

 

Value ... Date expression.
IncValue ... Integer value. Number of month.

 

Example:

Dim d
 
= Now
Inc(d, 2) ' increment d by 2 months
= d + 3 ' increment d by 3 days




Translate document: