0

GetMonthName's virtual ToString method that inside DateTimeFormatInfo class is not working properly.I 'm adding culture code to CultureInfo but it is returning invariant value.

DateTimeFormatInfo d = new DateTimeFormatInfo();
d.GetMonthName(1).ToString(new CultureInfo("tr-TR")); // returns January
Goran Zooferic
  • 371
  • 8
  • 23

1 Answers1

1

GetMonthName returns a string. There is no translation that happens when you call toString on a string even if you provide a CultureInfo. What you want to do is something like this:

var trTr = new CultureInfo("tr-TR");
trTr.DateTimeFormat.GetMonthName(1);
Eric MSFT
  • 3,246
  • 1
  • 18
  • 28