Select the product you need help with
- Internet Explorer
- Windows Phone
- More products
XsltListViewWebPart and ddwrt:DateTime limitations
Article ID: 2580994 - View products that this article applies to.
In Microsoft SharePoint Foundation and Microsoft SharePoint Server, the primary view technology is the XSLTListViewWebPart. Users can customize the XSLT by using Microsoft SharePoint Designer.
For backward compatibility, the ddwrt:DateTime function is available. However, it can produce inconsistent results if it is used inside the XSLTListViewWebPart Web Part.
For example, a user might add the following markup inside XSLTListViewWebPart:
If the user who accesses the page is located in the United States, and the date that is being formatted is 1/2/2011, the date is displayed correctly. However, if the user is located in the United Kingdom, the date is displayed incorrectly. In this case, "Tuesday, February 01, 2011" is incorrectly displayed instead of "Sunday, January 02, 2011."
This problem occurs because the ddwrt:FormatDate function expects the data format to be UTC, but XSLTListViewWebPart instead returns the date as preformatted to the web locale or to the locale date and time.
To resolve this problem, use the new EnableOriginalValue property that was added to the XlstListViewWebPart Web Part that unblocks this scenario. The previous workarounds are still valid until the February 2012 Cumulative Update is installed. For more information about the update, click the following article number to go to the article in the Microsoft Knowledge Base:
(http://support.microsoft.com/kb/2597132/ )Description of the SharePoint Foundation 2010 cumulative update package (SharePoint Foundation server-package): March 7, 2012
After you install this update, you must set the EnableOriginalValue property to True. The default value is False.
Note This setting slows down the rendering of the view because the server will have additional processing responsibilities. After the EnableOriginalValue property is set to True, you must change the XSLT to include the .ISO8601. To do this, use the following code:
To work around this problem, you can use any of the following methods if you have not yet installed Cumulative Update 2597132
For more information about the UseServerDataFormat property, go to the following MSDN article:
SPDataSource.UseServerDataFormat propertyWhen the UseServerDataFormat property is set to False, the DataFormWebPart Web Part receives the date/time information in UTC format. Therefore, the ddwrt:FormatDate function work correctly.
Article ID: 2580994 - Last Review: May 7, 2013 - Revision: 11.0