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

YEAR OF Function

The YEAR OF function converts the year portion of a date value you specify to a number value.

You can use this function when you need to use the year 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 year is based on the year of a Date variable.

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

d: DATE

The function returns the year portion of this date value.
Result A number value.

Example

In the following script, a new employee has temporary status until the end of their third month with the company. HotDocs uses the YEAR OF function (along with the DATE OF and MONTH OF functions) to determine the last day of their 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.