Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
My problem is, that suppose i have two datetime control like 'FromDate' & 'ToDate'.i want to insert n retrive data in that control without changing format of my system.
now my system format is date format is 1/3/2013.i dont want to change that.but i want to show in 3/1/2013..while giving a range.

so how wud i do,please help me.


Thanks,
Posted

This way...
C#
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd/yyyy";

Happy Coding!
:)
 
Share this answer
 
Comments
URVISH_SUTHAR1 3-Jan-13 8:19am    
yup set above code and its should work as expected :)
Aarti Meswania 3-Jan-13 8:23am    
why do you downvote my answer?
could you give a reason for this rating?
URVISH_SUTHAR1 3-Jan-13 8:26am    
above thing can be done both way like you suggested and also we can do in design time setting the same property at property window :)
Since you just want to show the date you can convert it to string and then just display the string like the following example:

C#
DateTime dateValue = dateTimePicker1.Value;
string showDate = dateValue.ToStrong("MM/dd/yyyy"); 
//Then just use the string to display the date
 
Share this answer
 

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