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 文化?


基础教程推荐
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 XML 转换为通用列表 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01