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

#1
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");
 


Josephur

Windows Forum Admin
Staff member
Premium Supporter
#2
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));
}
}
 


Elmer

Extraordinary Member
#3
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));
}
}
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!:))
 


Josephur

Windows Forum Admin
Staff member
Premium Supporter
#4
He is trying to format it specifically it seems, however you can change the format however you would like or let the system choose.
 


This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.
Top