Sharepoint xsl ddwrt FormatDateTime issue
I use the ddwrt:FormatDateTime function to format the output like yyyyMMdd. inputs like 01/01/2010 work fine but when the day gets over the number 12 the output is an emtpy string.
ddwrt:FormatDate(string(@myDate), 1033, 'yyyyMMdd开发者_运维知识库')
At first I thought it could be a language specific problem but even none of those combinations work:
13/01/2010
01/13/2010
13.01.2010
I googled and found out that sharepoint uses ISO8601 format of the date: yyyy-mm-ddThh:mm:ssZ"
Th same page and the Microsoft origin state that the third parameter of the function is long and not the formatting string.
In practice, there are two options for the third parameter. One is a long, the other works much as you believed.
The only problem with using the string option is that not all the possible combinations of yyyy M d (etc) work. "dddd MMMM d, yyyy" works fine, as does ".mm"; but not "mm". This is a pain, but is better than nothing.
精彩评论