c# - 瑞典文化信息

标签 c# asp.net culture

我想将日期时间转换为瑞典文化。

DateTime.Today.ToString("dd MMMM yyyy");

上面的代码行给我的结果是 2013 年 12 月 27 日

我想要以瑞典语显示 12 月的结果。

最佳答案

为此你应该使用瑞典文化:

DateTime.Today.ToString("dd MMMM yyyy", CultureInfo.GetCultureInfo("sv-SE"));

如果瑞典语应该在每个 ToString() 中使用,您可以设置 CurrentCulture:

  // Or/And CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("sv-SE");
  Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("sv-SE");
  ...

  // Since Current Culture is Swedish, there's no need to put it explicitly
  DateTime.Now.ToString("dd MMMM yyyy");    

关于c# - 瑞典文化信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20796497/

相关文章:

asp.net - 什么可能导致 Google Chrome 无法像 Firefox 那样呈现 ASP.Net 验证器?

c# - Java 等价于不变文化

c# - 根据用户选择生成 LinqToEntities Where 语句

c# - 为什么 Dictionary 没有 AddRange?

c# - 如何将复杂对象绑定(bind)到 DataGridView?

asp.net - 实现 HttpWorkerRequest

c# - 如何在 asp.net web api 中实现幂等 key ?

c# - 检查 HangFire.JobStorage 是否被实例化

时间:: In a dotnet class is there a property that states if the "Current" culture is actual the default culture?

C# + StyleCop + MSBuild + 全局区域性设置无法获取