How to produce localized date string with CultureInfo

前端 未结 2 1978
情深已故
情深已故 2020-12-06 09:18

I have the following code that produces a date string in en-us format. I would like to pass in the LCID (or equivalent value for the localized language) to produce the local

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-06 09:46

    Use an overload of ToString() instead of a ToShortDateString() method. Supply an IFormatProvider.

    This should be helpful in forming a specific date-time string:

    http://www.csharp-examples.net/string-format-datetime/

    This should be helpful with localization issues:

    How do you handle localization / CultureInfo

提交回复
热议问题