I am new to xslt and xquery . can someone please guide me with below:
I want to find out the difference in two date times is less than 24 hours by using xslt 1.0 or xquery
For example: In response I receive 2022-03-10T10:57:53.746-05:00
I want to compare it with current datetime and make sure it is less than 24 hours
To add to Martin's comment, a pure XPath 2 version (meaning compatible with XSLT 2 and all XQuery) is:
current-dateTime() - xs:dateTime('2022-03-10T10:57:53.746-05:00')
lt xs:dayTimeDuration("PT24H")
This is in case you weren't sure how to express the "less than 24 hours" condition. (An equivalent duration would be P1D
.)
But this expression isn't compatible with XSLT 1.0. For that, the link to the XSLT 1.0 solution from the comments would be required.