.net mvc date culture problem
when I have:
var cultureInfo = CultureInfo.CreateSpecificCulture("fr-fr");
return date.ToString("dd MMM", cultureInfo);
I get back: 01 févr.
When I run the same code but with "en-us", I get back 01 Feb
What I would like is to get 01 fév
Any idea why this is happening (essentially the French culture adds an extra letter and a period) and how to get it to display only 3 month letters?
Thanks
I think you'll have to specifically set the DateTimeFormatInfo.AbbreviatedMonthNames
property. You can have a look at the MSDN documentation here:
http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.abbreviatedmonthnames.aspx
Note that, according to the above doc, you also need to set the DateTimeFormatInfo.AbbreviatedMonthGenitiveName
property as well.
精彩评论