Tuesday, May 8, 2007

The LCID and FormatFlag in the ddwrt:FormatDate method

The following images illustrate the date strings output by setting the LCID and FormatFlag parameters in the ddwrt:FormatDate(szDate, lcid, FormatFlag) method. Note that the use of an LCID of 1053 and a FormatFlag of 5 gives a sortable string value.

I have added the code used to generate these lists in this post.

en-US (LCID 1033)

de-DE (LCID 1031)

es-ES (LCID 1034)

en-GB (LCID 2057)

10 comments:

K.D.Kadyan said...

Thanks,

just spend one minute on this due to your blog.

jecoso said...

Thank you for your post^^
Can you help me to get a detail list of the LCID and FormatFlg table??

Tnaks in advance^^

whats.to.learn.today said...

I have added a note about some sample application code I have posted to display the avaiable date formats - hope that helps

Mano Mangaldas said...

Thanks.

Michael said...

The LCID list is available at http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx and the foprmat list is available at http://msdn.microsoft.com/en-us/library/aa505323.aspx#officesharepointddwrt_formatdate

Andrej Dobrovoljc said...

When you use FormatDate function to display the current date (e.g. Today()) it works fine with all LCIDs. But when you try to use FormatDate function to display specific date, which is passed as input parameter in the form of 'dd.MM.yy' (dots as a delimiter insteda of '-' sign) the function returns blank string. Fro such date formating this function is useless. It is so with most European LCIDs, but works fine for US, because it uses '-' sign in the date formating. If somone knows the soluiotn to my problem, I will be very happy. It is described here: http://amavs.wordpress.com/2010/12/16/date-comparison-formatdatetime-function-ddwrt-namespace/

RupaliK said...

Really useful. I am newbie to xslt and this post really helped me.

RupaliK said...

Really useful.

Khushi said...

Is there any way to display ordinals formate? like January 1st 2010


Thanks,
Khushi

whats.to.learn.today said...

You could try using the ddwrt:FormatDateTime() function - see https://amavs.wordpress.com/tag/formatdatetime/ for a summary of the parameters of that function