Time Zone DST Offset and Raw Offset

Mar 12, 2010 at 3:05 AM

Hey guys,

I've been working with the raw tz database and found this API which is great! However i have a question that i was even having issues with when accessing the raw data.  here it goes:

For a given time zone such as "America/New_York" i need to know the following:

When DST starts and Ends and what the offsets are?  I can get all information but for the DST offset.  Example:

"America/New_York"

Start: 03/14/2010 2:00

End: 11/7/2010 2:00

Raw Offset: -800

DST Offset: -700

Sure if i was within the DST time frame i would have the DST offset but i need to know both.  I'm not using the API for calculations just to read Olson database for Time Zone Rules when it comes to DST.  Can this be done with the API and if not what could i do to try to get it and apply it within the API.  Thanks!

-Rich

Coordinator
Mar 13, 2010 at 9:27 PM

Hi Rich,

If I understand your question, you are trying to get the DST offset for a given date for a given zone.

In the Rule class, there is a property called Rule.Save which is the amount of time to add when this rule is being applied. It returns a TimeSpan. The name is a bit confusing but it was chosen as it matches the column it reads from in the zone database files.

There is a method on the Zone class called Zone.GetRule which will be able to give you the rule object for a given date and zone. Unfortunately this method is private right now but if you make it public and call it with the right parameters you should be able to get the Rule object out to get the 'Save' information.

Please let me know if I have misunderstood your question.

Cheers,

Mark

Jul 13, 2010 at 12:45 PM

Getting DST offset is fine. But we are also stuck at getting start and end dates for applying the DST offsets.

Is there a way (API) available for getting these start-end date pairs?

Thanks In Advance.

Kiran Rajput.