Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to format the date in xslt? [duplicate]

Tags:

xslt

How can we format the date in xslt ?

Example:

<xsl:value-of select ="name of function(I/P, 'MMM dd, yyyy')"/>
like image 954
Amit Avatar asked May 19 '10 06:05

Amit


1 Answers

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]')"/>
like image 172
markusk Avatar answered Oct 18 '22 10:10

markusk