XSLT 2.0 date formatting
From Birnam Designs Wiki
example:
Basic rules:
- F = day of week
- D = day of month
- M = month
- Y = year
- Nn = sentence case
- 1 = digit placeholder
- o = order
- *-x = size (output depends on value, e.g. [MNn,*-3] takes first three of month, [Y,*-2] takes last two of year
<xsl:value-of select="format-date(xs:date('2008-11-09'), '[FNn], [D1o] [MNn], [Y]')"/> // Sunday, 9th November, 2008 <xsl:value-of select="format-date(xs:date('2008-11-09'), '[FNn,*-3], [D11o] [M], [Y11]')"/> // Sun, 09th 11, 08 <xsl:value-of select="format-date(xs:date('2008-11-09'), '[FNn,*-2], [D1] [MN,*-3], [Y1111]')"/> // Su, 9 NOV, 2008 <xsl:value-of select="format-date(xs:date('2008-11-09'), '[FN], [D11] [Mn,*-3], [Y,*-2]')"/> // SUNDAY, 09 nov, 08 <xsl:value-of select="format-date(xs:date('2008-11-09'), '[Fn], [D1o] [MNn,*-3], [Y]')"/> // sunday, 9th Nov, 2008