我知道这个问题可能会重复出现,但我仍在学习(XML-XSLT : How to compare two dates which are in String)
EX:<oldDate>2019-09-25T10:49:52.755Z</oldDate>
<currentDate>2019-07-25T10:49:52.755Z</currentDate>
有人可以帮我吗 样例代码: XML-XSLT : How to compare two dates which are in String
EXPECTED输出:
<?xml version="1.0" encoding="utf-8"?>
<xml>
<output>OK</output>
</xml>
或
<?xml version="1.0" encoding="utf-8"?>
<xml>
<output>Not Ok</output>
</xml>
请有人帮我比较这种日期格式
答案 0 :(得分:1)
在将字符串转换为日期xs:dateTime()
之后,您可以简单地使用以下代码:
<xsl:value-of select="if (xs:dateTime(/root/oldDate) > xs:dateTime(/root/currentDate)) then ('OK') else ('Not OK')"/>