The HotDocs Computation Archive
Get Extra Help

0072 - Nearest/Next Business Day

Description:

How to automatically move a date that falls on a Saturday/Sunday to either the nearest or next business day.


• Code •

Nearest Weekday/Business Day:

IF DAY OF WEEK( DateVar ) = 1
   DateVar + 1 DAYS
ELSE IF DAY OF WEEK( DateVar ) = 7
   DateVar - 1 DAYS
ELSE
   DateVar
END IF
 
 
Next Weekday/Business Day:

IF DAY OF WEEK( DateVar ) = 1
   DateVar + 1 DAYS
ELSE IF DAY OF WEEK( DateVar ) = 7
   DateVar + 2 DAYS
ELSE
   DateVar
END IF

• Explanation •

This computation checks a date variable to see what day of the week it falls on using the DAY OF WEEK model. If DAY OF WEEK returns a 1 (Sunday) or a 7 (Saturday), then the date is appropriately moved to the next or previous weekday using DATE + NUM DAYS or DATE - NUM DAYS. The computation returns the adjusted date or, if no adjustment was made, the original date.

 

• Model Template •

This template has everything you need set up and configured for you. It will work as-is, or can be adapted to your variable and dialog names. It contains: 1) sample Word and WordPerfect templates (or an Automator form) to demonstrate an implementation of the computation, 2) a component file containing the computation and all supporting dialogs and variables, and 3) instructions for adapting the computation for your use.

(Go to the download page)

 
 

• Contributors •

LegalCS