Reputation: 1448
I am using x.CreatedDate.ToString("dd MMM") with the culture sk-SK and cz-CZ and both are returning Roman numerals for the medium month names.
The other cultures I've used with this solution work fine.
Any ideas?
Edit: adding code examples.
siteCultureInfo = CultureInfo.CreateSpecificCulture("sk-SK");
Thread.CurrentThread.CurrentUICulture = siteCultureInfo;
Thread.CurrentThread.CurrentCulture = siteCultureInfo;
string foo = x.CreatedDate.ToString("dd MMM");
Actual output where x = 13. 6. 2011 16:30:21 is 13 VI It should be 13 jún
Upvotes: 2
Views: 2441
Reputation: 27599
For sk-SK and cs-CZ it seems that the expected behaviour of MMM
in a custom date format is to return the roman numeral since this is how it is defined in that date format. I can't guarantee but I assume this is because that is the commonly used abbreviation in those countries.
You can always try using .ToString("dd MMMM")
which gives the full month name. Other than this there will be no "out of the box" solutions since this is how MS and thus the .NET framework think it works.
The last resort is to post-process the generated string and when it returns the Numeral version you can substitute it with the abbreviated month name that you want.
Upvotes: 2