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.

Share:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • LinkedIn
  • Reddit
  • RSS
  • Google Buzz
  • Tumblr

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>