Wednesday, September 24, 2014

How to format Date / DateTime fields in Sharepoint 2010 using custom xsl and ddwrt formatting

When getting Calendar items, use ddwrt:FormatDate to format Date/Time as your liking:

from <xsl:value-of select="ddwrt:FormatDate(string(@EventDate),2057,3)"/>
to <xsl:value-of select="ddwrt:FormatDate(string(@EndDate),2057,3)"/>


Also, you can use custom formatting with this:
<xsl:variable name="monthy" select="ddwrt:FormatDateTime(string(pubDate), 1033, 'MMMM')"/>


More Links to help you:
Available locales
Custom date formats
MSDN DateTime custom format
ms:format-date Function
XSLT Date format dd-MMM-yyyy using ddwrt:FormatDateTime
ddwrt FormatDate and FormatDateTime
How to format date value in SharePoint Data View Web Part – xslt

No comments:

Post a Comment