Skip to main content

A package to convert ZIP codes to time zones and get geographic coordinates.

Project description

documentation status https://img.shields.io/pypi/wheel/ziptimezone.svg total PyPI downloads latest version on PyPI https://img.shields.io/badge/code%20style-black-000000.svg

This is a python package with US Zip Code convenience functions such as those listed in the examples below. It uses the geonames data, coupled with the timezonefinder package. It uses a mapping of the popular timezone regions in US, and returns the outputs accordingly. Latest release includes dependency fixes and documentation updates.

Quick Guide:

pip install ziptimezone
import ziptimezone as zpt

# returns a tuple (42.377, -71.1256)
zpt.get_lat_long_for_zip('02138')

# returns 'Eastern' the timezone has been reduced to the more popular zones
# for United States Regions
zpt.get_timezone_by_zip('02138')

# returns a dictionary, {'02138': 'Eastern', '85260': 'Mountain'}
zpt.get_timezone_for_many_zips(['02138', '85260'])

# returns a string, '02138 is ahead of 72201 by 1.00 hours."}
zpt.calculate_time_difference_between_zips(['02138', '72201'])

# returns a dictionary, for 5/30/24 {'sunrise_time': '05:11:13', 'sunset_time': '20:13:31'}
today_sun_times = get_sunrise_sunset_for_zip("02138")

# Get sunrise and sunset times for ZIP code 02138 on July 4, 2024
# will return {'sunrise_time': '05:13:42', 'sunset_time': '20:24:10'}
july4_sun_times = get_sunrise_sunset_for_zip("02138", datetime(2024, 7, 4).date())

For more refer to the Documentation.

Also check:

PyPI

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ziptimezone-1.1.8.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

ziptimezone-1.1.8-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file ziptimezone-1.1.8.tar.gz.

File metadata

  • Download URL: ziptimezone-1.1.8.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Windows/10

File hashes

Hashes for ziptimezone-1.1.8.tar.gz
Algorithm Hash digest
SHA256 68d880e40f1b50d696ff5fff215653b267a588582e0891d1a63b867ad6ccbecf
MD5 cdb974ba209b304b5f15f62a50d0b8fa
BLAKE2b-256 f8333f6b098254450ad54d1d5d36b33c932ca65a46293d54c118beb5599b1012

See more details on using hashes here.

File details

Details for the file ziptimezone-1.1.8-py3-none-any.whl.

File metadata

  • Download URL: ziptimezone-1.1.8-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.9 Windows/10

File hashes

Hashes for ziptimezone-1.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9d736502362998e4ac8ef77edbe87a64049a3ad705734b91839c155dd73681bc
MD5 602e7291bc69587c0292363a98b6c5bb
BLAKE2b-256 bb85de1441cebbd238ccc14034db5b7efd766176b578ea138343f78924eaa30a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page