Search This Blog

Friday, July 9, 2010

XSLT Date format dd-MMM-yyyy using ddwrt:FormatDateTime

<xsl:value-of select="ddwrt:FormatDateTime(string(@Created) ,1033 ,'dd-MMM-yyyy')" />
will produce 25-Apr-2009
<xsl:value-of select="ddwrt:FormatDateTime(string(@Created) ,1033 ,'dd-MMMM-yyyy')" />
will produce 25-April-2009
<xsl:value-of select="ddwrt:FormatDateTime(string(@Created) ,1033 ,'dd/MMM/yyyy')" />
will produce the result
25/Apr/2009

3 comments:

  1. this will work only if you refer ddwrt namespace.

    xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"

    ReplyDelete
  2. I can't get this to work for sharepoint online. It works if I put 1 instead of 'MM/dd/YYYY' but not for the custom format.

    ReplyDelete