Day difference between two dates in XSLT version 2.

461 views Asked by At

Is there a easy way I can get how many days is the difference between two dates in XSLT.

1

There are 1 answers

0
Martin Honnen On BEST ANSWER

You can subtract one xs:date from another one and then you get an xs:dayTimeDuration of which you can extract components e.g. xs:date('2015-06-11') - xs:date('2015-06-01') gives an xs:dayTimeDuration P10D and you can then call http://www.w3.org/TR/xquery-operators/#func-days-from-duration e.g. days-from-duration(xs:date('2015-06-11') - xs:date('2015-06-01')) which gives 10.