如何格式化xslt中的日期? [英] How to format the date in xslt?

查看:33
本文介绍了如何格式化xslt中的日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何格式化 xslt 中的日期?

How can we format the date in xslt ?

示例:

<xsl:value-of select ="name of function(I/P, 'MMM dd, yyyy')"/>

推荐答案

如果您使用的是 XSLT 1.0,您可能会在 EXSLT - 日期和时间 很有用,特别是 格式日期.如果您使用的是 XSLT 2.0,您可以使用 Formatting Dates 中描述的内置函数和时代.

If you are using XSLT 1.0, you might find the date formatting features in EXSLT - Date and Times useful, in particular format-date. If you are using XSLT 2.0, you can use the built-in function described in Formatting Dates and Times.

作为后者的一个例子,如果你想以Jan 01, 2020"格式输出日期,你会写

As en example of the latter, if you want to output a date on the format "Jan 01, 2020", you'd write

<xsl:value-of select="format-date($d, '[MNn,*-3] [D01], [Y0001]')"/>

这篇关于如何格式化xslt中的日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆