Working with Date Formats in SharePoint 2010

As you may or may not know, you can sometimes use the Regional Settings in SharePoint to present dates and currency type information in a format that is typical for your locale. For example, today (March 26, 2012) is typically presented as 26/03/2012 in Canada however in the US you might see 03/26/2012.

By default, my SharePoint Server install was utilizing an English (United States) locale. Therefore when I viewed any date based column on the server, the date would be displayed as MM/DD/YYYY.

However using the Regional Settings option, I can change these dates to follow my regional preference.

Changing Your Regional Settings

To change your Regional Settings, expand the drop down menu that appears to the right of your name as shown in the image below and select the My Settings option.

Select the My Regional Settings link. If you do not see this option, you may not be permitted to change your Regional Settings by your System Administrator.

By default, your profile will follow whatever settings have been defined for the current site you are visiting. However by deselecting the checkbox, you can specify your own preferences for items such as Locale, Time Zone, and Calendar as shown below.

By selecting English (Canada) and saving my changes, I can return to my site and the previously shown list will now be displayed using the date format of DD/MM/YYYY.

 

Changing a Site’s Locale

You can also tweak a specific site or site collection to follow a specific locale. So for example, you may have your Newfoundland and Labrador sales team site use an English (Canada) locale but your Texas based sales team site would use the English (United States) locale. To change the locale for a specific site, go to the Site Settings area and select Regional Settings from the Site Administration group of links.

 

But What About Other Formats That Are Not Regional?

Some organizations have adopted a format that is compatible with ISO 8601 as the standard format for dates. This format would present the above referenced date as 2012-03-26. This is very common for organizations that are multi-national or have adopted a more standardized approach to Document Management and Records Keeping. Unfortunately, out of the box, SharePoint doesn’t offer a very simple way to format all dates in this manner. However there are workarounds. As with all workarounds, you may want to ensure you have considered the long term impacts of such approaches when it comes to manageability and maintenance.

For such scenarios, you can create custom calculated columns within your content types (recommended) or lists to display the date in the format desired. For example, to display content in a format that is consistent with ISO 8601, I would create two custom columns to represent ISO Formatted Created Date and ISO Formatted Modified Date on my content types called “Organizational Document” and “Organizational Item” which act as the parent for all my custom content types. This allows me to make these columns available throughout my SharePoint environment on all my custom content types that inherit from these parents.

To do this, I created a calculated site column called “Creation Date” with the following settings:

And another called “Modified On” with these settings:

 

Then in my various views throughout my site collection, rather than displayed the default Created and Modified date values, I would use my custom columns as shown below.