SharePoint Config

Ari Bakker's thoughts on customising and configuring SharePoint

Date Formats in SharePoint

with one comment

To ensure that dates are formatted correctly across your WSS or MOSS site there are a couple of settings you may need to change.

First of all the regional settings should reflect the current locale. This can be changed from Site Actions > Site Settings > Regional Settings and ensuring the locale is correct. This should ensure all controls that display dates are formatted correctly.

If you are using XSLT to display dates (such as in a data view web part) you may need to update these also. One way of doing this is to take advantage of the format-date extension function provided by MSXML. This is included in the XSL for the dataview by default, but you can use this and other MSXML extension functions by including a reference to the Microsoft XPath extension functions (urn:schemas-microsoft-com:xslt) at the top of your XSL stylesheet i.e.

<xsl:stylesheet ... xmlns:msxsl="urn:schemas-microsoft-com:xslt">

You can then use the format-date (and format-time) functions like so:

<xsl:value-of select="msxsl:format-date(@_DCDateCreated, 'dd/MM/yyy')"/>

This will format the date in the form 30/03/2007. The Microsoft XPath extension functions page contains a full list of formatting characters.

Note: you can also take advantage of the format-date function in other .NET applications that use xsl transforms.

Post to Twitter Post to Delicious Post to Digg Post to Reddit Post to StumbleUpon

Written by Ari Bakker

April 2nd, 2007 at 3:27 am

One Response to 'Date Formats in SharePoint'

Subscribe to comments with RSS or TrackBack to 'Date Formats in SharePoint'.

  1. Hi, I have a Search Center and in that Advanced Search, as you know helps us to select certain properties and search. For example, date created, date modified: these fields seem to be accepting only mm/dd format of dates and not dd/mm. Inspite of me changing to UK format in the regional settings. Any thoughts? This would be of great help.

    Karthick

    16 Apr 11 at 11:39 am

Leave a Reply

*