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.

Convert MM/DD/YYYY to DD/MM/YYYY



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 format


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


Related Articles

More articles: Format date Convert to date format Date formatting Date Format

Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: