Search code examples
databasegeolocationtimezonepostal-codegoogle-maps-timezone

Can there be a postal code area which falls on to multiple time zones?


Can there be a city/place which has some postal code 'XXXX' and it falls in to 2 or more time zones?

I'm not sure if this question is even valid or not. But because of the overwhelming information regarding locations and time zones in the Internet I got a bit confused.

(My requirement is actually to store user's country, city, postal code and time zone information in a database)


Solution

  • Yes. In theory, postal code boundaries and time zone boundaries are separate entities, and thus their can be oddities like one postal code with multiple time zones. It is possible.

    However, it is hard to find real-world examples. Cities that straddle official boundaries of state, county or country borders tend to have postal codes split along such boundaries, and may use a single time zone by convention - even if it's not the "official" one. (Though, that doesn't mean there aren't any.)

    Additionally, consider that many postal codes are not directly related to physical location, but rather are used for routing mail in a particular way. For example, several postal codes in the US are used for sending mail to members of various branches of the military - even if they happen to be stationed overseas. Therefore, not every postal code can be mapped to a time zone.

    A better approach is to use the information you have to approximate a latitude and longitude. This process is called "geocoding" and there are many online services that can perform this (including Google Maps). Then, use one of the techniques listed here (including Google Maps) to obtain a time zone ID for that location.