Skip to main content

Gets the timezone of any location in the world

Project description

Gets the timezone of any location in the world.

This uses google and caches the results so that you can hopefully stay outside the free rate limit (which I have no idea how high it is).

This is how you use it:

$ pip install whenareyou
$ ipython

In [1]: from whenareyou import whenareyou

In [2]: tz = whenareyou('Hamburg')

In [3]: tz
Out[3]: <DstTzInfo 'Europe/Berlin' LMT+0:53:00 STD>

In [4]: from datetime import datetime

In [5]: tz.localize(datetime(2002, 10, 27, 6, 0, 0))
Out[5]: datetime.datetime(2002, 10, 27, 6, 0, tzinfo=<DstTzInfo 'Europe/Berlin' CET+1:00:00 STD>)

In [6]: tz.localize(datetime(2002, 10, 27, 6, 0, 0)).isoformat()
Out[6]: '2002-10-27T06:00:00+01:00'

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

whenareyou-0.3.2.tar.gz (445.1 kB view hashes)

Uploaded Source

Built Distribution

whenareyou-0.3.2-py3-none-any.whl (449.9 kB view hashes)

Uploaded Python 3

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