Monday, 1 November 2010

SharePoint DateTime format is incorrect

Problem: The SharePoint DateTimeControl displays the date in US format i.e. 1033 or mm/dd/yyyy despite me changing the site collections regional settings.
Site Settings > Regional Settings > Locale > Select [English (United Kingdom)]

Inital Hypothesis: In MOSS changing the Locale did not change the format of the DateTimeControl. 
Resolution: This is still the case, you need to explicitly set the local on eash DateTimeControl.  You can set it to be the same as the site's local.
E.g. myDateTimeControl.LocaleId = SPContext.Current.Web.Locale.LCID 
Or set the "LocaleId"attribute of the SharePoint DateTime control
E.g. SharePoint:DateTimeControl runat="server" LocaleId="2057"

=========================
Tip: Changing the Regional settings will affect the curreny columns.

List of Locale's: http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx

====================

5 comments:

Anonymous said...

Complete novice to this, so where would you add such a line (your second example)?

Paul Beck said...

The dateTimeControl is a server control and the code in the 2nd example is on the aspx or user control. So on the front end page if you would be (it's decalritive).
So if you open the aspx or ascx it should look like:

Anonymous said...

0 down vote favorite
share [fb] share [tw]


I've created a Web Part using Visual STudio to show the selected columns of a list in gridview. But the problem is that whenever I'm changing the locale to English-UK (it's by default English-US), unfortunately it as well as the site has no effect on it though the date format is supposed to be changed.
I think the problem I'm facing is because of the custom wsebpart (containing a gridview of a list) I've created.Please help me out!!!

Paul Beck said...

I am struggling to follow your problem "Anonymous 19 Dec", are to explicitly setting the locale for the column? If you want some help, leave a clear message along the lines of problem, replication steps, things tried.

desraelectric said...

HI.,
I have created a Time Intelligence Connection Formula filter in PPS 2010 dashboard and deployed in sharepoint 2010.

now I want to change the date format as 'February 14th,2013'

I tried this by changing the locale in regional setting but still can't .

whether there is any other way to change the date format?

Post a comment