Int = MoveMonths(nDate, nMoveBy)
This macro function returns the first day of the month obtained by moving nMoveBy months from the month containing nDate.
Positive values move forward, negative values move backward, and 0 returns 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 10-Oct-2026