how to uppercase date and month first letter of ToLongDateString() result in es-mx Culture?(如何将 ToLongDateString() 的日期和月份首字母大写导致 es-mx 文化?)
问题描述
目前我在 es-MX Culture 中从以下 C# 代码行获得以下结果
currently i obtain the below result from the following C# line of code when in es-MX Culture
Thread.CurrentThread.CurrentCulture =
Thread.CurrentThread.CurrentUICulture = new
CultureInfo("es-mx");
<span><%=DateTime.Now.ToLongDateString()%></span>
miércoles,2008 年 10 月 22 日
我想获得以下内容
miércoles, 22 de octubre de 2008
i would like to obtain the following
我需要建立自己的文化吗?
do i need to Build my own culture?
推荐答案
你不需要建立自己的文化.您只需要更改当前文化中的属性 DateTimeFormat.DayNames 和 DateTimeFormat.MonthNames.
You don't need to build your own culture. You only need to change the property DateTimeFormat.DayNames and DateTimeFormat.MonthNames in the current culture.
即
string[] newNames = { "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado", "Domingo" };
Thread.CurrentThread.CurrentCulture.DateTimeFormat.DayNames = newNames;
但是,奇怪的是 en-US 以第一个大写字母显示月份和日期,而 mx-ES 则没有.
However, it's weird that en-US show months and days with the first uppercase letter and for mx-ES not.
希望对你有帮助!
这篇关于如何将 ToLongDateString() 的日期和月份首字母大写导致 es-mx 文化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 ToLongDateString() 的日期和月份首字母大写导致 es-mx 文化?
基础教程推荐
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- 将数据集转换为列表 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 如果条件可以为空 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
