I want to set format of date to dd-mm-yyyy for control date time picker,i m able to create date time picker dynamically but can not set its format to dd-mm-yyyy plz do needful....
+2
A:
Have you tried just setting the DateTimePicker.CustomFormat
property?
picker.Format = DateTimePickerFormat.Custom;
picker.CustomFormat = "dd-MM-yyyy";
(Note the MM for months; mm is for minutes.)
Jon Skeet
2010-10-07 06:37:47
thank you sir....Its working with slight change, dtp.Format = System.Windows.Forms.DateTimePickerFormat.Custom;dtp.CustomFormat ="dd-MM-yyyy";
Smack
2010-10-07 06:54:13
kool...working for me too
Sangram
2010-10-07 07:29:29
@Smack: Duly edited, thanks.
Jon Skeet
2010-10-07 07:40:18
+1
A:
Set format type to custom first:
DateTimePicker.Format = DateTimePickerFormat.Custom;
DateTimePicker.CustomFormat = "dd-MM-yyyy";
Andrei Bularca
2010-10-07 06:40:12
thank u its working with change as dtp.Format = System.Windows.Forms.DateTimePickerFormat.Custom;dtp.CustomFormat ="dd-MM-yyyy";
Smack
2010-10-07 06:56:28