1. 如何使用文化来格式化日期

如:

 1    /// <summary>
 2     /// 根据语言获取文化名称
 3     /// </summary>
 4     /// <returns></returns>
 5     public static string GetCultureName()
 6     {
 7         string cultureName;
 8         switch (MLocalization.language)
 9         {
10             case "Japanese":
11                 cultureName = "ja-JP";
12                 break;
13 
14             case "Taiwan":
15                 cultureName = "zh-TW";
16                 break;
17 
18             case "English":
19                 cultureName = "en-US";
20                 break;
21 
22             case "Korean":
23                 cultureName = "ko-KR";
24                 break;
25 
26             default:
27                 throw new InvalidOperationException("Not support language: " + MLocalization.language);
28         }
29 
30         return cultureName;
31     }
32 
33 
34 string cultureName = TextLocalization.GetCultureName();
35 var ci = new CultureInfo(cultureName);
36 DateTime.Now.ToString("yyyy MM/dd(ddd) HH:mm", ci)
example

相关文章:

  • 2021-11-30
  • 2021-07-27
  • 2022-01-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-22
  • 2021-11-12
相关资源
相似解决方案