InformationTitleRouter - Checking Relative DatesURL NameRouterCheckingRelativeDates6901fcfcd9957Step-by-StepContents: OverviewOperatorsChecking if a Date/Time Field Falls Within the Past X Days (Including Today)Checking if a Date/Time Field Falls Within the Next X Days (Including Today)Checking if a Date/Time Field Is X or More Days Before TodayChecking if a Date/Time Field Is X or More Days After Today Overview This guide shows you how to set up a Relative Date in your routing graph using the Formula Builder. The Relative Date function in Formula Builder lets you insert today's date, or a date a specific number of days before or after today (up to 365 days). Use it in Decision Nodes to compare a record's date/time field against a moving reference point. This is helpful for routing logic that depends on whether a date is recent, upcoming, overdue, or far in the future. The Relative Date function uses the syntax [!Datetime.daysAfter([]([Datetime.today](Datetime.today))()],{!numberofdays}]). A positive number returns a date that many days after today.A negative number returns a date that many days before today. For a full overview of Formula Builder and the other available functions, see the Formula Builder Article. Operators When comparing dates or date/times, you can use the following operators: OperatorDescriptionOn / AtOn a specific date / at a specific timeNot on / NotThe date or date/time is not the same as the field valueAfterAfter the date or date/timeOn or after / At or afterOn or after the date or date/timeBeforeBefore the date or date/timeOn or before / At or beforeOn or before a date / at or before a date/timeIs NullThe date or date/time field is blankNot NullThe date or date/time field is not blank Common Date/Time Comparisons Checking if a Date/Time Field Falls Within the Past X Days (Including Today) Replace X with the number of days needed for your use case. In your Decision Node condition, select the date/time field you wish to useSet the operator to at or after.Click Insert > Formula Builder. In the Formula Builder modal, select Relative Date from the function list.Choose the option for [X] day(s) before/after today (Now), enter the number of days, and select Before.Click Add Function, then Insert Formula to add the formula to the condition. Add a second condition. Set the rule logic to require both conditions (1 AND 2).Select the same date/time field, set the operator to On or before, then open Insert > Formula Builder again. In the Formula Builder modal choose the Relative Date option for Today. Click Add Function, then Insert Formula. Example: checking if the value is within the last 3 days 1. (Date on or after [!Datetime.daysAfter([)()],-3)]) 2. (Date on or before Today) Rule Logic 1 AND 2 Checking if a Date/Time Field Falls Within the Next X Days (Including Today) Replace X with the number of days needed for your use case. In your Decision Node, select the date/time field and set the operator to On or before.Click Insert > Formula Builder. In the Formula Builder modal, select Relative Date from the function list.Choose the option for [X] day(s) before/after today (Now), enter the number of days, and select After.Click Add Function, then Insert Formula to add the formula to the condition. Add a second condition. Set the rule logic to require both conditions (1 AND 2).Select the same date/time field, set the operator to On or after, then open Insert > Formula Builder again. In the Formula Builder modal, choose the Relative Date option for Today. Click Add Function, then Insert Formula. Example: checking if the value is within the next 3 days 1. (Date on or before [!Datetime.daysAfter([)()],3)]) 2. (Date on or after Today) Rule Logic 1 AND 2 Checking if a Date/Time Field Is X or More Days Before Today Replace X with the number of days needed for your use case. In your Decision Node, select the date/time field and set the operator to On or before.Click Insert > Formula Builder. In the Formula Builder modal, select Relative Date from the function list.Choose the option for [X] day(s) before/after today (Now), enter the number of days, and select Before.Click Add Function, then Insert Formula to add the formula to the condition. Example: checking if the value is 3 or more days before today 1. (Date on or before [!Datetime.daysAfter([)()],-3)]) Checking if a Date/Time Field Is X or More Days After Today Replace X with the number of days needed for your use case. In your Decision Node, select the date/time field and set the operator to On or after.Click Insert > Formula Builder. In the Formula Builder modal, select Relative Date from the function list.Choose the option for [X] day(s) before/after today (Now), enter the number of days, and select After.Click Add Function, then Insert Formula to add the formula to the condition. Example: checking if the value is 3 or more days after today 1. (Date on or after [!Datetime.daysAfter([)()],3)]) For questions or additional assistance, please contact LeanData Support.