Geeks With Blogs
Hani Amr

I've faced an issue that I wanted to display the date in the format of ('MMMM dd') that is retrieved from a sharepoint list in an arabic site collection.

So, after googling this issue, I've found out that a possible solution to my poblem is using the function ddwrt:FormatDateTime that can be used as long as you'll include the following namespace


My purpose was solved by writing this line of code in my xsl code behind for the webpart :

ddwrt:FormatDateTime(string(@StartDate),3073,'MMMM dd') but that worked only if the webpart is inserted into an English site .

After trying to search but in vain, I started to use my guesses that ended up doing something like that:

ddwrt:FormatDateTime(ddwrt:FormatDateTime(string(@StartDate),3073,'dd/MM/yyyy'), 3073, 'MMMM dd')

And the cause of the problem was that sharepoint parses the date as 'MM/dd/yyyy' which I think could be related to server regional settings, so I had to force it to parse the date in arabic-Egypt format as 'dd/MM/yyyy' in order to get the correct 'Month Day' format as expected.

Posted on Sunday, March 6, 2011 10:46 PM Sharepoint 2010 | Back to top

Copyright © H@Ni | Powered by: