# DateTime Diff

This Function returns a *\<string>*, which is the date time resultant of the sum between the specified **Date Time** and **Value**.

### Parameters

* **Date Time 1** *\<string> -* Date Time to subtract **Date Time 2** from. This parameter must be in format YYYYMMDDHHMISS.
* **Date Time 2** *\<string> -* Date Time to subtract from **Date Time 1**. This parameter must be in format YYYYMMDDHHMISS.
* **Return Type** *\<string> -* Unit of **Value** to return. The Possible values for this parameter are:
  * "S" - Second
  * "M" - Minute
  * "H" - Hour
  * "D" - Day
  * "HHMMSS" - Time
  * "DDHHMMSS" - Date Time

### **Examples**

* *Example 1*

DateTimeDiff("20120103091530", "20120103091550", "S")\
**Result** = 20

* *Example 2*

DateTimeDiff("20120103091530", "20120103091550", "D")\
**Result** = 0

* *Example 3*

DateTimeDiff("20120103091550", "20120103091530", "S")\
**Result** = 20

* *Example 4*

DateTimeDiff("20120103091530", "20120103091550", "HHMMSS")\
**Result** = 000020

{% hint style="info" %}
If the **Return Type** is a unit greater than the actual difference between **Date Time 1** and **Date Time 1**, the result will be 0
{% endhint %}

{% hint style="info" %}
If **Date Time 1** is later than **Date Time 2**, the parameters order is inverted in runtime. Therefore, the result of this function will never be preceded by minus sign.
{% endhint %}
