Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find out the actual times when DST starts/ends for a timezone and particular year?

Tags:

timezone

.net

dst

I want to know the exact time when DST starts/ends in a particular timezone and year.

Using TimeZoneInfo.GetAdjustmentRules and AdjustmentRule.DaylightTransitionStart I can get a TransitionTime object which specifies the DST start moment rule.

Let's assume that I find the adjustment rule that applies for 2010. How do I convert it's TransitionTime object to a DateTime in 2010?

Timezone: (UTC-05:00) Eastern Time (US & Canada)
Valid: 01.01.2007 00:00:00 - 31.12.9999 00:00:00
DST Start TransitionTime:
    IsFixedDateRule: false
    Month: 3
    Week: 2
    DayOfWeek: Sunday
    TimeOfDay: 02:00:00
like image 560
Meh Avatar asked Nov 07 '10 14:11

Meh


1 Answers

MSDN has the sample. See DisplayTransitionInfo function at the bottom.

like image 175
Dmitry Ornatsky Avatar answered Oct 14 '22 10:10

Dmitry Ornatsky