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 7563041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:33:52+00:00 2026-05-30T13:33:52+00:00

This round trip fails I suspect due to the resultant middle time being ambiguous.

  • 0

This round trip fails I suspect due to the resultant middle time being ambiguous. Is there anything that can be done about this? It doesn’t match the result of:

http://www.timeanddate.com/worldclock/converted.html?month=11&day=6&year=2011&hour=1&min=59&sec=0&p1=179&p2=75

Is that just coincidence that .NET pick one possibly ambiguous time and that web site picked the other and that was the one I expected back?

I recognize the solution is to store times in UTC, but I’m dealing with a legacy app.

public const string EASTERN_TIMEZONEID = "Eastern Standard Time";
public const string MOUNTAIN_TIMEZONEID = "Mountain Standard Time";

[TestMethod]
public void MountainToEasternToMountain_DaylightSavings_Test()
{
    DateTime originalTime = new DateTime(2011, 11, 5, 23, 59, 0);   //  November 5, 2011 - 11:59pm
    DateTime expectedMiddle = new DateTime(2011, 11, 6, 1, 59, 0);  //  November 6, 2011 - 1:59am
    DateTime expectedEnd = originalTime;                            //  November 5, 2011 - 11:59pm

    TimeZoneInfo easternTimeZone = TimeZoneInfo.FindSystemTimeZoneById(EASTERN_TIMEZONEID);
    TimeZoneInfo mountainTimeZone = TimeZoneInfo.FindSystemTimeZoneById(MOUNTAIN_TIMEZONEID);

    var middleTime = TimeZoneInfo.ConvertTime(originalTime, mountainTimeZone, easternTimeZone);

    var isSourceAmbiguous = mountainTimeZone.IsAmbiguousTime(originalTime);
    var isMiddleAmbiguous = easternTimeZone.IsAmbiguousTime(middleTime);

    Assert.AreEqual(expectedMiddle, middleTime);

    var destTime = TimeZoneInfo.ConvertTime(middleTime, easternTimeZone, mountainTimeZone);

    var isMiddleSourceAmbiguous = easternTimeZone.IsAmbiguousTime(middleTime);
    var isDestAmbiguous = mountainTimeZone.IsAmbiguousTime(destTime);

    Assert.AreEqual(expectedEnd, destTime);
}     
  • 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-05-30T13:33:54+00:00Added an answer on May 30, 2026 at 1:33 pm

    This round trip fails I suspect due to the resultant middle time being ambiguous. Is there anything that can be done about this?

    Not if you want to keep things in a DateTime representing local time, no. Fundamentally, you’re losing data: there are two input values which map to the same output value, which obviously prohibits round tripping.

    I’m assuming that being a legacy app prohibits the possibility of using Noda Time instead too, which allows all of this to be handled a bit more sensibly…

    It’s not clearer what the bigger picture is, but you won’t be able to get away from the fact that converting from a local time (without offset) in one time zone to either another local time or to a universal time fundamentally has three possible outcomes:

    • 2 results: the local time occurred twice
    • 1 result: the local time was unambiguous
    • 0 results: the local time was skipped
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I calculate or estimate the RTT (Round Trip Time) between client and
This one goes round and round I know but I can't seem to find
I have a timedate string in a round-trip data pattern like this: 2012-07-05T11:30:44.1533815Z .
This article explains why string Encoding shouldn't be used to round-trip the cipher text.
I know that given enough time I'll figure this out, but it sure would
I am building an HTML Gui builder and this involves round-tripping HTML pages from
Ok this is new, Math.Round(1.5) returns 2, i need 1. How to handle this?
I made this method + (CGFloat) round: (CGFloat)f { int a = f; CGFloat
Weird question this, going round in circles. I have 2 pages. Page 1. Has
round(45.923,-1) gives a result of 50. Why is this? How it is calculated? (sorry

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.