On Thu, Feb 09, 2006 at 12:05:42PM -0800, Bill Moseley wrote: > On Fri, Jan 20, 2006 at 07:26:16AM -0800, Bill Moseley wrote: > > I have a zipcode table that lists the city, state, timezone offset > > (eg -5) and a flag indicating if the location uses daylight saving > > time for U.S. zipcodes. I don't have the Olson name in the table. > > > > How do I set the timezone in this case -- taking into > > account the dst settings? > > I kind of left this hanging. > > Is it possible to set a timezone on a DateTime object based on only > the above information? Seems like one would need to know more (such > as when Daylight Saving is in effect for that location. But, if so, > could I see an example?
Yes, it's possible. I assume the timezone offset is the non-dst offset. I'm not sure if Samoa uses US zipcodes :) Offset dst flag Olson zone -11 no US/Samoa or Pacific/Pago_Pago -10 no HST or US/Hawaii or Pacific/Honolulu -10 yes US/Aleutian or America/Adak -9 yes US/Alaska or America/Anchorage -8 yes PST8PDT or US/Pacific or America/Los_Angeles -7 no MST or US/Arizona or America/Phoenix -7 yes MST7MDT or US/Mountain or America/Denver -6 yes CST6CDT or US/Central or America/Chicago -5 no EST or US/East-Indiana or America/Indiana/Indianapolis -5 yes EST5EDT or US/Eastern or America/New_York I'm pretty sure the missing combinations of offset/dst flag don't exist in the US. DateTime-TimeZone includes the first and third columns of zone names; I'm not sure why it doesn't include those in the second column. For your amusement, the Olson files have this comment (among others) about DST usage in the Falkland Islands: # I know one lady there that keeps a list of which farm keeps DST and # which doesn't each year. She runs a shop in Stanley, and says that # the list changes each year. She uses it to communicate to her # customers, catching them when they are home for lunch or dinner.