Modify application wide, the display of DateTime

后端 未结 3 700
北荒
北荒 2021-01-25 03:12

For an application we develop, we use the \"G\" format everywhere in our application.

We want to change a little bit this format:

We need to display

3条回答
  •  心在旅途
    2021-01-25 03:55

    You can set the CurrentCulture for the current thread and specify a deviating LongTimePattern:

    CultureInfo culture = Thread.CurrentThread.CurrentCulture.Clone();
    
    change the culture.DateTimeFormat.LongTimePattern = "your pattern";
    
    Thread.CurrentThread.CurrentCulture = culture;
    

提交回复
热议问题