开发者

How to format the date in xslt? [duplicate]

This question already has answers here: Format a date in XML via XSLT 开发者_如何学C (9 answers) Closed 8 years ago.

How can we format the date in xslt ?

Example:

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


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.

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]')"/>


This will probably help: ms:format-date Function

Using the example from the article you can format a date as follows:

Date Unedited: 2000-02-16T15:56:00

Date Edited: Feb 16, 2000

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜