I wanted to ask the community if my approach to building tables for Time
Zones and Daylight Savings Time is correct. I would like to build with the
following thoughts in mind: 1) time zones are an offset (in hours) to GMT, 2
)
adjustments to time zones can be made during Daylight Savings Time, 3)
different regions of the world have different rules (or no rules) regarding
the start date and end date of Daylight Savings Time. 4) The start date and
end date of Daylight Savings Time can change from year-to-year. 5) the
year-to-year adjustment to Time Zones can change (i.e. during Daylight
Savings Time, the Time Zone is adjusted by 1 hour, the next year the time
zone is adjusted by 2 hours).
I know that my design below is flawed for situation #5. I am welcome to as
many suggestions as possible for a viable solution for all 5 thoughts above.
tblTimeZone:
TimeZoneID (PK)
TimeZoneRegionID (FK)
TimeZoneName
RegularTime_GMT_HourOffset
SavingsTime_GMT_HourOffset
tblTimeZoneRegion:
TimeZoneRegionID (PK)
TimeZoneRegion
tblDST
TimeZoneRegionID (PK)
inYear (PK)
SpringForward_date
FallBack_date
I am using the following pseudocode to adjust the local Time Zones into a
common GMT Time:
IF[date-time in question] BETWEEN tblDST.SpringForward AND tblDST.FallBack
THEN adjust [date-time in question] by tblTimeZone.SavingsTime_GMT_Offset
ELSE adjust [date-time in question] by tblTimeZone.RegularTime_GMT_Offset.Your first assumption is a bit flawed; New Delhi in India is currently
at UTC + 5:30. Yes, it is true that India spans two time zones, and
technically one time zone is UTC + 5 and the other is UTC +6, the
country has an official time that splits the difference.
Not sure about the others; just thought I'd point the first one out.
Stu
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment