Click here to Skip to main content
15,887,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi in winform default date time picker format is "Monday .july 29.2012"

so how can i chnage this to 7/09/2012 this format?

can any one help me?
thanks
Posted

Use the DateTimePicker.Format[^] property...

C#
myDateTimePicker.Format = DateTimePickerFormat.Custom;
myDateTimePicker.CustomFormat = "dd/MM/yyyy";



[edit]Added example - OriginalGriff[/edit]
 
Share this answer
 
v4
Comments
ythisbug 9-Jul-12 5:49am    
thanks but this format is displaying like "july 29.2012 Monday "
OriginalGriff 9-Jul-12 5:52am    
Did you set both properties?
ythisbug 9-Jul-12 5:55am    
//dateTimePicker1.CustomFormat = "MM,dd,yyyy";
ya i tried like this
OriginalGriff 9-Jul-12 6:09am    
Have you tried uncommenting it?
And you do have to set the Format property to "Custom"
ythisbug 9-Jul-12 6:33am    
ya i tried thanks
Use CustomFormat property and define format as per your need.
C#
public void SetMyCustomFormat()
{
   // Set the Format type and the CustomFormat string.
   dateTimePicker1.Format = DateTimePickerFormat.Custom;
   dateTimePicker1.CustomFormat = "dd/MM/yyyy";
}

Refer: MSDN: DateTimePicker.CustomFormat Property [^]
 
Share this answer
 
v2
Comments
Shahin Khorshidnia 9-Jul-12 5:57am    
+5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900