What is the proper date time format for Windows 7 64 bit

Discussion in 'Windows 7 Software' started by umeshchaand, Jun 23, 2011.

  1. umeshchaand

    umeshchaand New Member

    Joined:
    Jun 23, 2011
    Messages:
    2
    Likes Received:
    0
    I get a date time exception while calculating time difference between two dates in C# code.

    This occours only with 32 bit Windows 7.

    Could anyone help me with this ..


    return printDate.ToString("MM/dd/yyyy HH:mm:ss");
     
  2. Josephur

    Josephur Windows Forum Admin
    Staff Member Premium Supporter

    Joined:
    Aug 3, 2010
    Messages:
    1,019
    Likes Received:
    125
    This works fine on my 32 and 64-bit Windows 7:

    using System;


    public class TimeTest
    {
    public static void Test()
    {
    DateTime time = DateTime.Now;
    string format = "MM/dd/yyyy HH:mm:ss";
    Console.WriteLine(time.ToString(format));
    }
    }
     
  3. Elmer

    Elmer Extraordinary Member

    Joined:
    Mar 5, 2010
    Messages:
    3,873
    Likes Received:
    284
    Hey Josephur, would that work in the UK but as dd/MM/yyyy HH:mm:ss, as we write the day first (smallest to largest, d,m,y!:))
     
  4. Josephur

    Josephur Windows Forum Admin
    Staff Member Premium Supporter

    Joined:
    Aug 3, 2010
    Messages:
    1,019
    Likes Received:
    125
    He is trying to format it specifically it seems, however you can change the format however you would like or let the system choose.
     

Share This Page

Loading...