Search code examples
xmlxsltxslt-1.0soawso2-esb

How to compare Dates in XSLT


I am using XSLT version 1.0. I want to compare two dates( > or < or =).

Can any one help me? Below are the dates which I want to compare

1.2016-07-11 05:00:00 2.2016-07-11 06:00:00

Thanks.


Solution

  • XSLT 1.0 has no concept of dates and cannot compare them as such.

    However, you can easily convert the given dates to comparable numerical values. For example:

    translate($date1, '- :', '') &lt; translate($date2, '- :', '')
    

    will return true.