XSL 1.0 将日期时间从 GMT 转换为本地时间
我正在创建一个 XSL 样式表来处理 XML 文件并生成 HTML 文件。我面临的挑战是 XML 文件中的日期时间值看起来像“2011-01-07T18:56:31Z”。
据我所知,Z 表示现在是 GMT,我想将其转换为当地时间,但我不知道该怎么做。
我可以解析日期时间值并获取年、月、日、小时、分钟和秒,但在执行此操作之前我需要将其转换为本地时间,并且我不确定 XSL 1.0 中存在哪些函数(如果有)会让我这样做。
你有什么想法吗?
谢谢, 凯文
I am working on creating an XSL stylesheet that processes an XML file and produces an HTML file. The challenge I am having is that the datetime value in the XML file looks like "2011-01-07T18:56:31Z".
From what I can figure out, the Z indicates that it is at GMT and I'd like to convert it to my local time but I'm not sure how to do that.
I can parse the datetime value and get the year, month, day, hours, minutes and seconds but I need to convert it to my local time before I do that and I am unsure what, if any, functions exist in with XSL 1.0 that would allow me to do that.
Do you have any ideas?
Thanks,
Kevin
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用
date:add()
和date:difference
EXSLT 函数,用于其中有 Jenni Tennison 编写的纯 XSLT 实现。You can use
date:add()
anddate:difference
EXSLT functions, for wich there are pure XSLT implementations written by Jenni Tennison.