Calculate date difference
Calculate date difference
Calculates the difference between two dates and returns the result in the desired time unit. Ideal for measuring deadlines, calculating ages, counting overdue days or checking how long ago an event happened — without having to perform manual calculations.
Options
Initial date
Use a date relative to the robot's execution?
Defines whether the initial date will be the current date at the moment of the execution. Select Yes to use it automatically, or No to provide a specific date.
Input format
Select the format of the initial date provided. This field is only shown when Use a relative date is set to No.
Enter the initial date
Enter the start date of the interval. This field is only shown when Use a relative date is set to No.
Final date
Use a date relative to the robot's execution?
Defines whether the final date will be the current date at the moment of the execution. Select Yes to use it automatically, or No to provide a specific date.
Input format
Select the format of the final date provided. This field is only shown when Use a relative date is set to No.
Enter the final date
Enter the end date of the interval. This field is only shown when Use a relative date is set to No.
Time unit
Select the unit in which the difference between the dates will be calculated. The options include days, weeks, months, years, hours, minutes and seconds.
Returns
Custom code
actions["action-id"].value // difference between the dates in the unit selected (Number)
Field selection
- value — numeric value of the distance between the two dates (Number)
Rules and Conditions
- The Time unit field is required.
- For each date, when Use a relative date is No, the Input format and Date fields are required.
- The result is always a positive value — the order of the dates does not affect the sign of the return.