Intranoggin

Blither, Blather, Web Content Management.
Blog » CQWP: 30 Tips #9 Date Formatting with the Power of SP Designer

CQWP: 30 Tips #9 Date Formatting with the Power of SP Designer

If you’re using SharePoint Designer in a DataView web part, you’ve got great guid formatting options for dates.  But those formatting options won’t cross over to CQWP without a little help.

I first posted about this in October of 2008: http://www.intranoggin.com/2008/10/765/

Josh Gaffey also wrote a nice post about it in 2009: http://blogs.msdn.com/b/joshuag/archive/2009/03/25/custom-date-formats-in-sharepoint-xsl.aspx

The quick tip is that first you add this SharePoint Designer namespace to your CQWP’s .xsl xmlns:ddwrt=http://schemas.microsoft.com/WebParts/v2/DataView/runtime

Then you can use the ddwrt:FormatDate function to format dates almost any way you’d like: <xsl:value-of select=”ddwrt:FormatDate(@date, local, formatoption)”/>

<xsl:value-of select=”ddwrt:FormatDate(@Modified, 1033, 1)”/>

Josh included a great table of local and format options in his post.


Posted: 2/15/2012 4:43:00 AM by Ryan Miller | with 0 comments
Filed under: SharePoint