使用文化设置日期时间选择器格式 [英] Set date time picker format with culture

查看:130
本文介绍了使用文化设置日期时间选择器格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的C#Windows窗体中,我将文化更改为日语,如下所示

In my c# windows form I change culture to japanese as follows

Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");

Thread.CurrentThread.CurrentUICulture = new CultureInfo("ja-JP");



但是在我的日期中,时间选择器以区域和语言日期格式显示日期格式.

是否可以通过更改区域性来设置日期格式,而无需为日期时间选择器设置自定义格式.



But in my date time pickers shows the date format in Regional and Language date format.

Is there any way to set the date format wihtout setting the custom format for the date time picker by changing the culture.

推荐答案

http://stackoverflow.com/questions/241964/how-to-change -culture-to-a-datetimepicker-or-calendar-control-in-net [ http://msdn.microsoft.com/en-us/library/aa983603%28v = vs.71%29.aspx [ ^ ]
http://stackoverflow.com/questions/241964/how-to-change-culture-to-a-datetimepicker-or-calendar-control-in-net[^]

http://msdn.microsoft.com/en-us/library/aa983603%28v=vs.71%29.aspx[^]


我使用的是
Console.WriteLine(string.Format(System.Globalization.CultureInfo.CreateSpecificCulture("en-US"),"{0:ddd,dd MMM yyyy tt}",dateTimePicker1.Value));

取得上午/下午.

-

Microsoft编写的datepicker和month控件不能受Culture或CultureUI影响.

http://support.microsoft.com/Default. aspx?scid = kb%3ben-us%3b889834& x = 18& y = 19 [
I use
Console.WriteLine(string.Format(System.Globalization.CultureInfo.CreateSpecificCulture("en-US"), "{0:ddd, dd MMM yyyy tt}", dateTimePicker1.Value));

to get am/pm.

-

Microsoft writes the datepicker and month controls cant be affected by Culture or CultureUI.

http://support.microsoft.com/Default.aspx?scid=kb%3ben-us%3b889834&x=18&y=19[^]


这篇关于使用文化设置日期时间选择器格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆