Roboteka
Roboteka · Robots · Difference between two dates

Difference between two dates

The Difference Between Two Dates robot calculates how much time has passed between date 1 and date 2 in the chosen unit: days, hours, minutes or whole months (days by default). It returns the signed difference (negative if date 2 is earlier than date 1), its absolute value and the number of full days. Use it in Bitrix24 (Alaio) business processes and robots to compute deadlines.

The robot calculates the difference between two dates and immediately returns three values for further checks and calculations. The inputs are date 1 (start), date 2 (end) and the unit: days, hours, minutes or months (whole months); if the unit is not set, days are used. The outputs are: diff — the signed difference in the chosen unit (negative if date 2 is earlier than date 1), diff_absolute — the same difference as an absolute value, always positive, and days — the number of full days between the dates. Use it to compute how many days a deal has been at a stage, the age of a lead from its creation date, or how many hours remain until a task deadline. If one of the dates cannot be parsed, the robot returns zeros. The diff value is convenient to compare against a threshold in the condition of the next step of the business process.

What input parameters does the robot accept?

Parameter Type Required? Default
Date 1 (start) date yes
Date 2 (end) date yes
Unit: days / hours / minutes / months (default: days) string

What does the robot return?

Parameter Type
Difference (can be negative if date2 < date1) int
Difference (always positive) int
Full days (always) int

Scenario: monitor a deal's time at a stage

  1. A deal enters the In progress stage
  2. The robot calculates the difference between the creation date and the current date in days
  3. If diff is over 7, the process creates a reminder task for the responsible person

Related robots

Related articles