Determine the First Day of Next Month

From HotDocs Wiki

Jump to: navigation, search

In some templates, you may need to calculate the first day of the month after a given date. For example, if new employees at a company begin accruing vacation time on the first day of the month following their hire date, a template can use the hire date to automatically determine when vacation days will begin to accrue.

Example

The following computations show how to compute the first day of the next month. The first example uses a Date variable, and the second example uses the TODAY variable, which means the computation will always return the first day of the next month after today's date.

In these examples, "Date Var" is any Date variable.

//Example 1: Find the first day of the first month following a given date.
Date Var + 1 MONTH
DATE OF( 1, MONTH OF( RESULT ), YEAR OF( RESULT ) )
 
//Example 2: Find the first day of next month (based on today's date).
TODAY + 1 MONTH
DATE OF( 1, MONTH OF( RESULT ), YEAR OF( RESULT ) )