Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9102001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:16:24+00:00 2026-06-17T01:16:24+00:00

Doing the following on XP and Windows 7 yields different results in a .NET4

  • 0

Doing the following on XP and Windows 7 yields different results in a .NET4 vs. a .NET2 console application:

Console.WriteLine(String.Format("DateTime.Parse on Client: {0}", 
   DateTime.Parse("1998-10-31T00:00:00-04:00")));

.NET4
Under XP this returns: 10/31/1998 12:00:00 AM
Under Windows 7/Windows 8 this returns: 10/30/1998 11:00:00 PM

.NET2
Under XP this returns: 10/31/1998 12:00:00 AM
Under Windows 7/Windows 8 this returns: 10/31/1998 12:00:00 AM

WHY??!?

Removing the TimeZone (the -04:00) from the string causes the value to be the same on both XP and Windows 7 under .NET4. It appears that Windows XP applies the timezone offset differently under .NET4 when doing a DateTime.Parse from the string. Is there some way to change this behavior so that it is consistent under .NET4, reguardless of OS (that does not involve manipulating the string being sent into DateTime.Parse)

Environment:
All machines have the latest patches installed (available via Windows Update) and are configured to Eastern Time with the ‘Automatically adjust clock for Daylight Savings Time’ checked in the ‘Time Zone Settings’.

I have confirmed this behavior on both a Windows 7 machine with .NET4 and a Windows 7 machine with .NET4.5

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:16:25+00:00Added an answer on June 17, 2026 at 1:16 am

    Calculating the local time for historical dates requires .NET knowing the daylight savings time rules that were in effect during that date. That’s of course a pretty tricky thing to do since DST rules vary a great deal across localities and dates.

    Your date has a UTC offset of -4 which puts it somewhere close to the Eastern timezone in the USA. The most relevant DST rule change there was the 2005 Energy Policy Act which extended the period that DST is in effect from the 2nd Sunday in March to the 1st Sunday in November, effective in 2007. So knowing the local time in October 31st, 1998 requires knowing that this law was not yet in effect.

    And that’s where the difference comes from. Windows Vista was the first Windows version that has a database of these DST changes, .NET 4 was the first .NET version that started using it. XP doesn’t have that database so .NET cannot do anything but assume that current DST rules are in effect.

    This is the inevitable lossage you need to deal with when working with local time. Don’t, use UTC.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently doing the following as part of my iPhone application NSArray *paths =
I am doing the following class RuleObject implements Comparable{ @Override public String toString() {
I am developing an application in OpenCV, and on Windows the following code is
When doing easy_install ssl I get following error: C:\Windows\system32>easy_install ssl Searching for ssl Reading
I'm developing a Windows Phone 7.1 application. I have the following folders structure: -
I'm doing application testing on Windows Server 2012 to check compatibility of our web
I my index lets say I have field field named full_name. I'm doing following
While doing the following simple example, I found the following difficulties As the title
After doing the following test: for( i = 0; i < 3000000; i++ )
I'm currently doing the following to compensate for boolean's not mapping well to radio

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.