# dateDiff

## Description

Calculates the difference between two dates, measuring the duration or interval between them in terms of days, weeks, months, etc.

## Input / Parameter

| Name     | Description                                  | Input Type  | Default        | Options                                             | Required |
| -------- | -------------------------------------------- | ----------- | -------------- | --------------------------------------------------- | -------- |
| value1   | The start date, this becomes the subtrahend. | String/Text | (Current-Date) | -                                                   | Yes      |
| value2   | The end date, this becomes the minuend.      | String/Text | (Current-Date) | -                                                   | Yes      |
| interval | The value to be checked.                     | String/Text | days           | years, months, weeks, days, hours, minutes, seconds | No       |

## Output

| Description                                                                                                            | Output Type    |
| ---------------------------------------------------------------------------------------------------------------------- | -------------- |
| Returns the difference between two dates in terms of days. Will be negative if `value2` is an early date than `value1` | Number/Integer |

## Callback

N/A

## Video

Coming soon.

## Example

### Steps

1. Using the dates `2023-01-01` and `1970-01-01`

![](/files/X5kIL4NJdJr2FeSpZnyx)

### Result

Will return the value:

```
-19358
```

## Links


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/object/datediff.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
