core module¶
- ziptimezone.core.calculate_time_difference_between_zips(zip1, zip2)[source]¶
Calculate the nominal time difference between the time zones of two given ZIP codes.
- Parameters:
zip1 (str) – The first ZIP code.
zip2 (str) – The second ZIP code.
- Returns:
A string describing the nominal time difference in hours between the time zones of the two ZIP codes, if both ZIP codes are valid and in the US, otherwise an error message.
- Return type:
str
- ziptimezone.core.get_lat_long_for_zip(zip_code, country='US')[source]¶
Retrieve the latitude and longitude for a given ZIP code.
- Parameters:
zip_code (str) – The ZIP code for which geographic coordinates are requested.
country (str) – Country code to refine the search, default is ‘US’.
- Returns:
A tuple containing latitude and longitude (float, float) if found, otherwise (None, None).
- Return type:
tuple
- Raises:
ValueError – If the ZIP code is not recognized or data is missing.
- ziptimezone.core.get_timezone_by_zip(zip_code)[source]¶
Retrieves the timezone based on the provided ZIP code using geographic coordinates.
- Parameters:
zip_code (str) – The ZIP code for which the timezone is requested.
- Returns:
- The timezone string (e.g., ‘America/New_York’) if found,
returns ‘Unknown’ if the timezone cannot be determined.
- Return type:
str
- ziptimezone.core.get_timezone_without_map_by_zip(zip_code)[source]¶
Retrieves the timezone based on the provided ZIP code using geographic coordinates. Without any Custom mapping. :param zip_code: The ZIP code for which the timezone is requested. :type zip_code: str
- Returns:
- The timezone string (e.g., ‘America/New_York’) if found,
returns ‘Unknown’ if the timezone cannot be determined.
- Return type:
str