Content Query Web Part Date Format

Firstly, follow Heather Solomon’s blog on a great how to customise the content query web part. Essentially, you need to allow the webpart to expose itself to whatever information you need it to display.

I had a roll up of information, which ideally I needed the article date to display on the page.

Links: http://www.heathersolomon.com/blog/articles/customitemstyle.aspx

Follow on to the MSDN blog which is found within the above link (http://blogs.msdn.com/ecm/archive/2006/10/25/configuring-and-customizing-the-content-query-web-part.aspx)

I managed to get what I wanted… but in an American date and time format, which was a big no no for me.

Fortunately, there was a post on the SharePoint User Group forum for UK members.

All you need to do is edit itemstyle.xsl to include xmlns:ddwrt=”http://schemas.microsoft.com/WebParts/v2/DataView/runtime  as a reference on the top header and amend the description tag to <xsl:value-of select=”ddwrt:FormatDateTime(string(@Modified) ,1033 ,’d/M/yyyy h:mm tt’) />

You can remove the time, amend the date as you wish.

If you do unfortuantly break your SharePoint site with any mistakes, not to worry, reset to the site definition using SharePoint Designer.

Any questions let me know!

Advertisements

Tags: , ,

One Response to “Content Query Web Part Date Format”

  1. Steve Says:

    Good tip! I was having the opposite problem. My dates were formatting YYYY-MM-DDDD but I changed the format characters and it worked. One note: if you copy/paste the code from this page and it does not work you may have to re-type the quotes. Something about the way they are formatted.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: