I am developing a C# application where user can select any date time format and display in date time picker.How to change the format of date time picker in code?
+5
A:
If you want to set your own custom format, you can set the following two properties of your Date Time Picker control to achieve this:
dateTimePicker1.CustomFormat = "yyyy mm ddd";
dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
Obviously, you can replace "yyyy mm ddd" with any valid date format string.
CraigTP
2009-07-09 08:21:09
A:
You can go here DateTimePicker and here to get the format of definitions DateTimePicker CustomFormat
Khan
2009-09-16 19:49:15
A:
use capital M for month ...
dateTimePicker1.CustomFormat = "yyyy MM ddd";
dateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
AmiT
2009-09-16 19:59:11