Post by nickIs there a way to get the difference between 2 dates in XPath? Eg. how
do I calculate age from date of birth? Thanks!
XPath 2.0 has support for the xs:date and the xs:dateTime data types and
operators on them.
So in XPath 2.0 you can do e.g.
current-date() - xs:date('1956-12-07')
to get a xs:dayTimeDuration. You could then extract the days and divide
by 365 to find the years e.g.
days-from-duration(current-date() - xs:date('1956-12-07')) idiv 365
should give 52.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/