Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
i am using textbox with calender extender.. after selecting date its displays in his textbox but in MM-DD-YYYY format.. i want it in DD-MM-YYYY... please suggest back code in C# code
Posted

Try this.
C#
               string str = "05-27-2013";//YourTextBox.Text here
               string requierDate = DateTime.Parse(str/*YourTextBox.Text here*/).ToString("dd-MM-yyyy");

//output will be "27-05-2013"

hope so it will help you.
 
Share this answer
 
Hi,

Use below code to convert date from one format to another format.

DateTime now = DateTime.Now;
string resultDate = (now).ToString("MM-dd-yyyy");
or

string resultDate = (now).ToString("dd-MM-yyyy");

Raman
 
Share this answer
 
v2

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