how to uppercase date and month first letter of ToLongDateString() result in es-mx Culture?

前端 未结 4 696
栀梦
栀梦 2021-01-05 05:45

currently i obtain the below result from the following C# line of code when in es-MX Culture

   Thread.CurrentThread.CurrentCulture =
     Thread.CurrentThr         


        
4条回答
  •  清歌不尽
    2021-01-05 06:20

    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.

    i.e.

            string[] newNames = { "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sabado", "Domingo" };
            Thread.CurrentThread.CurrentCulture.DateTimeFormat.DayNames = newNames;
    

    However, it's weird that en-US show months and days with the first uppercase letter and for mx-ES not.

    Hope it helps!.

提交回复
热议问题