TimeZoneInfo.Local vs TimeZoneInfo.FindSystemTimeZoneById
<p>I've been working with the <code>DateTime</code> and <code>TimeZoneInfo</code> classes and I ran into an interesting result with the following code:</p>

<pre><code>var dstStart = new DateTime(2013, 3, 10, 2, 0, 0, DateTimeKind.Local);
var result = TimeZoneInfo.Local.IsDaylightSavingTime(dstStart);
</code></pre>

<p>The result of this is <code>False</code>. I actually would have thought it would be <code>True</code> (DST starts on March 10th at 2:00 AM)</p>

<p>Then I tried similar code using <code>FindSystemTimeZoneById</code> instead:</p>

<pre><code>var myTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
var result = myTimeZone.IsDaylightSavingTime(dstStart);
</code></pre>

<p>The result of this is surprisingly <code>True</code>.</p>

<p>I then checked to see that these objects are both representing the same time zone:</p>

<pre><code>myTimeZone.Id == TimeZoneInfo.Local.Id // returns True (Both are "Eastern Standard Time")
</code></pre>

<p>My question is: <strong>why are these results different, and more importantly how can I make them the same?</strong> </p>

<p>My computer is definitely in the <code>Eastern Standard Time</code> time zone</p>

<p>More information:</p>

<p>I resynced my computer's clock, and I ran a number of tests to compare the <code>TimeZoneInfo</code> object that was returned by each of the above methods. Here is my test program</p>

<pre><code>var timeZoneFromLookup = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");

var dstStart = new DateTime(2013, 3, 10, 2, 0, 0, DateTimeKind.Local);

// -- The following return true --

Console.WriteLine("Equal? {0}", TimeZoneInfo.Local.Equals(timeZoneFromLookup));

Console.WriteLine("Has Same Rules? {0}", TimeZoneInfo.Local.HasSameRules(timeZoneFromLookup));

Console.WriteLine("Same Id? {0}", TimeZoneInfo.Local.Id == timeZoneFromLookup.Id);

Console.WriteLine("Same Base UTC Offset? {0}", TimeZoneInfo.Local.BaseUtcOffset == timeZoneFromLookup.BaseUtcOffset);

Console.WriteLine("Same Daylight Name? {0}", TimeZoneInfo.Local.DaylightName == timeZoneFromLookup.DaylightName);

Console.WriteLine("Same Display Name? {0}", TimeZoneInfo.Local.DisplayName == timeZoneFromLookup.DisplayName);

Console.WriteLine("Same Standard Name? {0}", TimeZoneInfo.Local.StandardName == timeZoneFromLookup.StandardName);

Console.WriteLine("Same Support For DST? {0}", 
    TimeZoneInfo.Local.SupportsDaylightSavingTime == timeZoneFromLookup.SupportsDaylightSavingTime
);

Console.WriteLine("Same result as to whether date/time is ambiguous? {0}", 
    timeZoneFromLookup.IsAmbiguousTime(dstStart) == TimeZoneInfo.Local.IsAmbiguousTime(dstStart)
);

// -- The following return false --


Console.WriteLine("Same utc offset result? {0}", 
    timeZoneFromLookup.GetUtcOffset(dstStart) == TimeZoneInfo.Local.GetUtcOffset(dstStart)

);
Console.WriteLine("Same Conversion to UTC? {0}", 
    TimeZoneInfo.Local.GetUtcOffset(dstStart) == timeZoneFromLookup.GetUtcOffset(dstStart)
);

Console.WriteLine("Same result as to whether date/time is invalid? {0}", 
    timeZoneFromLookup.IsInvalidTime(dstStart) == TimeZoneInfo.Local.IsInvalidTime(dstStart)
);

Console.WriteLine("Same result as to whether date/time is DST? {0}", 
    timeZoneFromLookup.IsDaylightSavingTime(dstStart) == TimeZoneInfo.Local.IsDaylightSavingTime(dstStart)
);
</code></pre>
