Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# : Why is my SqlDateTime.MinValue different on different machines?

Tags:

c#

datetime

I just found that my SqlDateTime.MinValue is different on different machines.

Sometimes it is = DateTime(1953, 1, 1, 0, 0, 0);

but on other machines it is = DateTime(1753, 1, 1, 0, 0, 0);

How can that be? OS on both machines is WinXP SP2.

Edit:

My code was like this:

DateTime date;

...

if (date == SqlDateTime.MinValue)
{
    return "(any)";
}
else
{
    return date.ToString();
} 

This code should never return January 1, 1753 but it did (on some machines). The minutes and seconds of date are not used by my code and should always remain default values.

like image 367
TalkingCode Avatar asked Jan 12 '10 11:01

TalkingCode


1 Answers

I know this issue happened on old Windows NT machines, where the date range was 1953-XXXX, instead of 1753-9999. Are you totally sure that these machines are both running Windows XP?

like image 62
Jan Jongboom Avatar answered Oct 10 '22 21:10

Jan Jongboom