I have an XML
file which includes some dates with start and end points, like shown as follows:
<start time="2016-02-21T00:59:06+02:00"/>
.....
.....
<end time="2016-02-22T02:24:38+02:00"/>
Question:
How to calculate the difference between two time attributes?
Then I would suggest you do it along the lines of:
Full demo: http://xsltransform.net/jz1PuNG
Your dates are in ISO format so in XSLT 2.0 you can do
The result is an
xs:dayTimeDuration
, which you can convert to seconds (for example) by doingUsing XSLT3.0 compliant Saxon processor, I use this (should work for 2.0 also):- xs is xsd schema
Here's a purely XSLT 1.0 solution:
Demo: http://xsltransform.net/jz1PuNG/1