A Practical Guide to SharePoint 2013

A Practical Guide to SharePoint 2013
A Practical Guide to SharePoint 2013 - Book by Saifullah Shafiq

Tuesday, August 2, 2011

Bug With SharePoint 2010 XSLT DateFormatFunction(VIA estruyf)

Extracted from the original post

Yesterday I found out that there is a problem/bug using the XSLT ddwrt:DateFormat function. The problem/bug occurs when the regional settings is not set to English (United States).

When a day got the value between 1 and 12, the ddwrt:DateFormat function will recognize this as the month. The month value will be used as the day.

So if the day value is less than 13, you get the following problem:

US Date Format

ddwrt:DateFormatTime(date, 1043, ‘dd-MMMM-yyyy’)

8/6/2011

8-June-2011

2/3/2011

2-March-2011

When the day value is larger than 13, you get the correct formatting:

So if the day value is less than 13, you get the following problem:

US Date Format

ddwrt:DateFormatTime(date, 1043, ‘dd-MMMM-yyyy’)

8/19/2011

19-August-2011

2/30/2011

30-February-2011

I did not notice it in the beginning, because my settings are always set to English (United States) on my development server. When I implemented the XSLT stylesheet on a different environment, where the regional settings were set to Dutch (Belgium), some of dates were incorrectly formatted.

For complete blog post click here.

No comments:

Post a Comment