Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A good approach would be to map a zip code to the named timezone (e.g. US/Eastern). Then, if you need to produce the UTC offset, apply the timezone to a date using pytz and get the offset.

The named timezone is special as it is constant. The UTC offset timezone (e.g. "-05:00") and the shorthand name (e.g. "EST") is NOT constant over time for a given location, because of daylight savings time. "US/Eastern" flips between "-05:00" and "-05:00", as well as between "EDT" and "EST".

If you ask someone what their timezone is and offer them offsets or the short names, it causes confusion for everyone.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: