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?

Bill Moseley then wrote:
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?

As you say, you don't know *when* the DST is in effect. I'm not sure about the US, but two here, given PostCode 3030, the first '3' indicates Victoria. There's only one TZ in Victoria therefore I can map any postcode starting with a 3 to Australia/Melbourne

Does the US ever have more than one TZ per state? As you have the state information, it wouldn't be hard to get a hash of states -> Olson Time Zone names. If you have more than one TZ per state, I'd have to assume its rare and so you could do those states by hand (painful I know, but I imagine there's a ZIP <-> lat/lon table around that would help you divide the state into positive regions (http://www.zipinfo.com/search/zipcode.htm). After that you can hand-cut those along the edges of those regions.

Just a few thoughts

Cheers!
Rick Measham

--
 "War is God's way of teaching Americans geography."
                             -- Ambrose Bierce

Reply via email to