DateTimeFormat.AbbreviatedMonthNames adding a dot at the end of month's name

后端 未结 1 1694
梦毁少年i
梦毁少年i 2020-12-21 13:04

Last night we migrated our web services tier from physical Windows 2008 r2 to virtual Windows 2012.

We are getting tons of events on ours logs about DateTime\'s inv

相关标签:
1条回答
  • 2020-12-21 13:57

    Sadly I couldn't find anything in the configuration that pointed me in the right direction.

    Ended with a nasty hack like this:

    var cultura = CultureInfo.CreateSpecificCulture("es-MX");
    if (cultura.DateTimeFormat.AbbreviatedMonthNames.First().EndsWith("."))
       cultura.DateTimeFormat.AbbreviatedMonthNames = cultura.DateTimeFormat.AbbreviatedMonthNames.Select(c => c.Substring(0, c.Length > 1 ? c.Length - 1 : 0)).ToArray();
    

    and used that culture in the parsing.

    0 讨论(0)
提交回复
热议问题