Convert date format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Swati Gunda
    New Member
    • Mar 2007
    • 2

    #1

    Convert date format

    Hi,
    I am working on visual studio.net (1.1). I want to convert the date from mm/dd/yyyy format into dd/mm/yyyy. I have writtern the following code in c#

    DateTime dt;
    string str=System.Date Time.Today.Date .ToString("dd/MM/yyyy");
    dt = Convert.ToDateT ime(str);

    In str variable it stores date in dd/mm/yyyy format. and in dt it again stores the date in the default one i.e. mm/dd/yyyy

    If you know the solution please reply me immediately.

    Thanks,
    Swati
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    Generally, you only need to change the date format for display purposes. I suggest storing it as is and then formating it when you need to display it again on a page.

    Comment

    Working...