Please enable JavaScript to view this site.

 

Int = MoveMonths(nDate, nMoveBy)

 

This macro function returns a date up or down by nMoveBy months, to the first day of the month containing nDate.

 

ØThe result of this function will always be the first day of some month, regardless of the date number of nDate.

 

The macro code below shows some examples of the use of the function MoveMonths, and in the last example, how to use it to calculate the end of a month.

nFirstOfNextMonth = MoveMonths(Today(),1)
nFirstOfThisMonth = MoveMonths(Today(),0)
nFirstOfLastMonth = MoveMonths(Today(),-1)
nEndOfThisMonth = Add(MoveMonths(Today(),1),-1)

See also: FirstDateOfMonth, LastDateOfMonth and NumDaysInMonth.

 


Topic 108269, last updated on 18-Apr-2020