Skip to main content

$dateDiff

The $dateDiff operator calculates the difference between two dates in specified units.

Input

  • An array containing two date objects and a string representing the unit of measurement (“days”, “hours”, “minutes”, “seconds”, “weeks”, “months”, “years”)

Output

  • The difference between the two dates in the specified unit

Examples

Calculate Days Difference

Result: 5

Calculate Hours Difference

Result: 5

Calculate Field Values Difference

Result: The difference in months between the end_date and start_date fields