Convert MM/DD/YYYY to DD/MM/YYYY
Convert MM/DD/YYYY to DD/MM/YYYY
description :convert your date format using asp.net c#, by using simple way.
When we store the date in any database by default it is saved in mm/dd/yyyy format , and at the retival time it's display also in same formatConvert MM/DD/YYYY to DD/MM/YYYY
here i show a method to convert date format using simple steps
String cdate="12/20/2007"
// and you want to convert into dd/mm/yyyy format
//call this function
dtod(cdate);
public string dtod(string str1)
{
if (!(str1 == ""))
{
string newdate1 = "";
string[] strnewdate = new string[3];
char[] ch ={ '/' };
strnewdate = str1.Split(ch);
string dd = strnewdate[0];
string mm = strnewdate[1];
string yy = strnewdate[2].Substring(0, 4);
newdate1 = mm + "/" + dd + "/" + yy;
return newdate1;
}
return str1;
}
//you will get 20/12/2007
