datetime-diff
Returns the duration obtained by subtracting datetime2 (second argument) from datetime1 (first argument). The result can be mapped to a string or duration data type.
![mf-func-datetime-diff](./images/mf-func-datetime-diff.png)
Languages
Built-in, C++, C#, Java.
Parameters
Name | Type | Description |
---|---|---|
datetime1 | xs:dateTime | Provides the first xs:dateTime value. |
datetime2 | xs:duration | Provides the second xs:dateTime value. |
Example
In the mapping illustrated below, the datetime-diff function subtracts the flight departure datetime 2001-12-17T09:30:02+05:00 from the arrival datetime 2001-12-17T19:30:02+05:00. Note that the arrival datetime is the greater value, so it is connected to the first input of the function.
![mf-func-datetime-diff-example](./images/mf-func-datetime-diff-example.png)
The mapping output is the difference between the two (a period of 10 hours):
PT10H |