Since silverlight doesn’t have complete TimeZoneInfo I will need to implement some of the functionality myself. For example, this following info comes from .NET TimeZoneInfo
ID: Central Standard Time
Display Name: (UTC-06:00) Central Time (US & Canada)
Standard Name: Central Standard Time
Daylight Name: Central Daylight Time ***Has Daylight Saving Time***
Offset from UTC: -6 hours, 0 minutes
Number of adjustment rules: 2
Adjustment Rules:
From 1/1/0001 12:00:00 AM to 12/31/2006 12:00:00 AM
Delta: 01:00:00
Begins at 2:00 AM on Sunday of week 1 of April
Ends at 2:00 AM on Sunday of week 5 of October
From 1/1/2007 12:00:00 AM to 12/31/9999 12:00:00 AM
Delta: 01:00:00
Begins at 2:00 AM on Sunday of week 2 of March
Ends at 2:00 AM on Sunday of week 1 of November
My question is how do I implement such rule when I need to convert from UTC to local and back?
Should I take UTC, substract 6 hours and then check if it’s after 2am on Sunday of week 2 of March and then add 1hr?
Or should I take UTC, check if it’s after 2am and then substract 5?
The time that Daylight Saving Time takes effect is local to that timezone, not UTC. So you should take the UTC time, subtract 6 hours off, do the check and then add the hour back on if applicable.