Date Calculations
Once the Event App has been configured, you can use specific calculations to determine duration taking into consideration non-working days.
The below table provides an overview of the 3 calculation formulas available:
durationWorkingDays(<StartDateValue>, <EndDateValue>, <IncludeStartValue>, <IncludeEndValue>) | Integer | Duration expressed in number of days excluding configured non-working days with possibility to define if start/end date or both should be included in duration calculation. For the formula to work, Events app must be configured for the site. Follow this link to access configuration guide. *Works only with Date and date-time fields. In case of date-time fields, only date is used in calculation, hours and minutes are ignored. Week-year, month-year fields may return inconsistent results. |
addWorkingDays(<StartDateValue>, <AmountOfDays>, <IncludeStartValue>) | Date | Function adds specifed number of days excluding non-working days, with parameter to define if start date should be included in calculation. *Works only with Date and date-time fields. In case of date-time fields, only date is used in calculation, hours and minutes are ignored. Week-year, month-year fields may return inconsistent results. |
subtractWorkingDays(<StartDateValue>, <AmountOfDays>, <IncludeStartValue>) | Date | Function subtracts specifed number of days excluding non-working days, with parameter to define if start date should be included in calculation. *Works only with Date and date-time fields. In case of date-time fields, only date is used in calculation, hours and minutes are ignored. Week-year, month-year fields may return inconsistent results. |
Examples:
Duration Calculation
Formula: durationDays(${Start date}, ${End date}, true, true)
Project start date: 01/01/2021
Project end date: 02/01/2021
Duration will be equal to 2.
Formula: durationDays(${Start date}, ${End date}, true, false)
Project start date: 01/01/2021
Project end date: 02/01/2021
Duration will be equal to 1.
Formula: durationDays(${Start date}, ${End date}, false, true)
Project start date: 01/01/2021
Project end date: 02/01/2021
Duration will be equal to 1.
Formula:durationDays(${Start date}, ${End date}, false, false) Project start date: 01/01/2021
Project end date: 02/01/2021 Duration will be equal to 0.Adding/Subtracting days respecting non-working dates
Formula: addWorkingDays(${Start date}, ${Integer}, true)
Project start date: 31/12/2020
Days to add: 3
Event start date: 01/01/2021Event end date: 02/01/2021
Resulting calculated date is 04/01/2021
Formula: subtractWorkingDays(${Start date}, ${Integer}, true)
Project start date: 31/12/2020
Days to subtract: 3
Event start date: 29/12/2020Event end date: 30/12/2020
Resulting calculated date is 27/12/2020Formula: addWorkingDays(${Start date}, ${Integer}, false)
Project start date: 31/12/2020
Days to add: 3
Event start date: 01/01/2021Event end date: 02/01/2021
Resulting calculated date is 05/01/2021
Formula: subtractWorkingDays(${Start date}, ${Integer}, false)
Project start date: 31/12/2020
Days to subtract: 3
Event start date: 29/12/2020Event end date: 30/12/2020
Resulting calculated date is 26/12/2020
Note!
When calculating duration or adding/subtracting days respecting non-working days, event duration is always calculated including start and end date.
Example:
Event start date: 01/01/2021
Event end date: 01/02/2021
Event duration (total number of days) is 2.
Known Limitations:
Long numbers (more than 6 digits) cannot be used as increments in date calculation formulas;
Event is ignorred if its Start date > End date.