开发者

.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

-开发者_StackOverflow-MB


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜