DAYS
Use the DAYS function to return the number of days between two dates, as a Number.
Use
DAYS( end_date, start_date )
Returns the number of days between two dates.
| Parameter | Required | Description |
|---|---|---|
| end_date | Yes | the start_date and end_date are the two dates between which to return the number of days |
| start_date | Yes | the start_date and end_date are the two dates between which to return the number of days |
| Returns | Number |
Examples
Calculating Duration for Leave Requests
In a leave approval workflow, you may want to calculate the total length of time a person will be away. This can be used in an Input Mapping formula to show a reviewer exactly how many days are being requested.
- Formula:
DAYS(@Trigger.out.ReturnDate, @Trigger.out.LeaveDate) - Logic: If the user enters a
LeaveDateof 14/06/2024 and aReturnDateof 21/06/2024, the function will return 7. This numeric value can then be used in further logic, such as checking if the request exceeds the user's remaining leave balance.
Validation for Age Requirements
You can use the DAYS function within Validation Logic to ensure that a submitted date meets specific criteria, such as verifying that an individual is at least 18 years old based on their date of birth.
- Formula:
DAYS(TODAY(), @Trigger.out.DateOfBirth) >= (18 * 365) - Logic:
TODAY(): Returns the current system date.@Trigger.out.DateOfBirth: Pulls the birth date provided in the trigger form.- Result: The function calculates the total number of days between the two. If the result is less than 6,570 (roughly 18 years), the formula returns FALSE, and the entry is marked as invalid.