how to chnage date format from dd-MM-yy to MM-dd-yy in asp.net
I have date "22-12-2012"
i want to change into "12-22-2012"
when i try to convert it gives me error
String was not recognized as a valid DateTime.
Change date from "22-12-2012" to "12-22-2012"
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Hemant SrivastavaRank #581 · 4.2K reputationPosted Feb 5, 2013, 8:46 AM EST
Hemant SrivastavaRank #581 · 4.2K reputationPosted Feb 5, 2013, 1:01 PM EST
string originalDate = "22-12-2012";
string[] dateParts = originalDate.Split('-');
string convertedDate = dateParts[1] + "-" + dateParts[0] + "-" + dateParts[2];
Console.WriteLine(convertedDate);
Jignesh TrivediRank #16 · 50.3K reputationPosted Feb 5, 2013, 5:57 PM EST
I think this is duplicate quesion
http://www.c-sharpcorner.com/Forums/Thread/200801/change-date-from-22-12-2012-to-12-22-2012.aspx