如何使Datetimepicker独立于我的Winform应用程序中的系统日期格式 [英] How Can I Make The Datetimepicker Independent From The Systems Date Format In My Winform Application
本文介绍了如何使Datetimepicker独立于我的Winform应用程序中的系统日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我 am 使用 DateTimePicker , i set 它的 customFormat property to dd / MM / YYYY。 在 system i 格式 M / d / yyyy。 i make DateTimePicker 独立 来自 systems 一个。
我 试过 语句 喜欢
MyDate 。格式 = DateTimePickerFormat 跨度> .Custom;
MyDate .CustomFormat =dd / MM / yyyy;
但是它不是 work 。
解决方案
我已经解决了这个问题。在将日期插入表格之前,以及每当我想根据sysytem更改格式的地方时,我都会通过此代码更改它并且
String date = MyDate.Text;
DateTime paydate = Convert.ToDateTime(date,System.Globalization.CultureInfo.GetCultureInfo( hi-IN 跨度>)DateTimeFormat);
I am using DateTimePicker , i set it's customFormat property to dd/MM/yyyy. In the system i have the format M/d/yyyy. How can i make the DateTimePicker independent from the systems one.
I have tried statements like
MyDate.Format = DateTimePickerFormat.Custom;
MyDate.CustomFormat="dd/MM/yyyy";
but it's doesn't work.
解决方案
I have solved this . Before insert date in to table, and every where when i want to change format according sysytem then i changed it by this code and
String date = MyDate.Text; DateTime paydate =Convert.ToDateTime(date,System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);
这篇关于如何使Datetimepicker独立于我的Winform应用程序中的系统日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文