Reputation: 495
Is there a easy way I can get how many days is the difference between two dates in XSLT.
Upvotes: 1
Views: 414
Reputation: 167571
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
.
Upvotes: 1