HotDocs Author WorkflowCreate a template Add placeholders Group variables in dialogs Upload a template Create a script

MONTH OF Function

The MONTH OF function converts a Date variable's answer to a number (between 1 and 12) corresponding to the month the date falls in.

You can use this function when you need to use the month portion of a date in a calculation or comparison. It can also be useful when constructing a date value using the DATE OF function where the month is based on the month of a Date variable.

Function name MONTH OF
Usage model MONTH OF ( d:DATE )
Parameters This function requires you to replace only one parameter:

d: DATE

The function returns the month portion of this date value.
Result A number value (between 1 and 12) corresponding to the month the date falls in:
  • 1 = January
  • 2 = February
  • 3 = March
  • 4 = April
  • 5 = May
  • 6 = June
  • 7 = July
  • 8 = August
  • 9 = September
  • 10 = October
  • 11 = November
  • 12 = December
 

Example

In the following script, a new employee has temporary status until the end of her third month with the company. HotDocs uses the MONTH OF function (along with the DATE OF and YEAR OF functions) to determine the last day of her third month:

DATE OF( 1, MONTH OF( HireDate + 3 MONTHS ), YEAR OF( HireDate + 3 MONTHS ) ) - 1 DAYS

For example, if the start date is 3 June 2018, three months are added to that date to get the month and year when the employee hits three months (3 September 2018), which is actually in the fourth calendar month of employment. The script then gets the first day of that month (1 September 2018) and subtracts one day to get the last day of the previous month (31 August 2018)—that is the day on which the employment status changes from temporary to permanent.