如何在 xslt 2.0 中将字符串解析为日期 [英] How to parse string to date in xslt 2.0
本文介绍了如何在 xslt 2.0 中将字符串解析为日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将 30042013
(2013 年 4 月 30 日)之类的字符串转换为日期格式?
Is it possible to convert strings like 30042013
(30 April 2013) to a date format?
所以我以后可以在诸如 format-date
So I can use it later in functions like format-date
推荐答案
fn:dateTime($arg1 as xs:date?, $arg2 as xs:time?)
将其参数转换为 xs:dateTime
.
只需使用 fn:substring()
和 fn:concat()
在将其传递给 fn:dateTime
之前,剪下相关部分并将它们连接为 yyyy-mm-dd
.
Just use fn:substring()
and fn:concat()
to cut out the relevant parts and join them as yyyy-mm-dd
before passing that to fn:dateTime
.
这篇关于如何在 xslt 2.0 中将字符串解析为日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文