Skip to main content

View datetime in different time zones.

Project description

tzview

PyPI Build Status License: MIT

View datetime in different time zones.

Given a time zone and datetime, tzview can find the datetime at other time zones.

The time zone names are those as specified in the Olsen time zone database (tz).

tzview merely leverages pytz package to get the job done.

Installation

You need Python>=3.6 to use tzview.

It can be installed from PyPI with pip using

pip install tzview

Usage

Defaults

The string 'local' can be used to specify the local time zone. This is the source time zone by default.

The string 'now' can be used to specify the local datetime. This is the source datetime by default.

Command line usage

To get the current time at Tokyo relative to your computer's current time and time zone, use

python3 -m tzview Asia/Tokyo

to get something like

2020-05-24 09:16:05.281238+09:00 : Asia/Tokyo

You could provide source datetime using --dt option and source time zone with --from-tz option. Like

python3 -m tzview --dt "2020-03-23 11:32:34" --from-tz Asia/Tokyo Europe/Oslo Asia/Istanbul

to get an output like

2020-03-23 03:32:34+01:00 : Europe/Oslo
2020-03-23 05:32:34+03:00 : Asia/Istanbul

Use python3 -m tzview --help for more.

Usage as module

The tzview() function can be used. It accepts the extension name as string.

Return value would be a list of timezone aware datetimes.

For example,

>>> from tzview import tzview
>>> t(['Europe/Oslo'])
[datetime.datetime(2020, 5, 24, 12, 6, 14, 272335, tzinfo=<DstTzInfo 'Europe/Oslo' CEST+2:00:00 DST>)]

>>> t(['Europe/Athens', 'Asia/Singapore'])
[datetime.datetime(2020, 5, 24, 13, 11, 7, 32042, tzinfo=<DstTzInfo 'Europe/Athens' EEST+3:00:00 DST>), datetime.datetime(2020, 5, 24, 18, 11, 7, 32042, tzinfo=<DstTzInfo 'Asia/Singapore' +08+8:00:00 STD>)]

Why

It is useful to figure meeting times when you got to attend meeting at a different time zone.

Or when calling a friend at another timezone to figure out the time of the day there.

That's what I use it for. :-)

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

tzview-0.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

tzview-0.3-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file tzview-0.3.tar.gz.

File metadata

  • Download URL: tzview-0.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for tzview-0.3.tar.gz
Algorithm Hash digest
SHA256 bb65ae6f035371beefa2212d12183b868c13c216181992398c67181ec2a14226
MD5 c8e43f6072359e3400f3f22ed38b0ca9
BLAKE2b-256 60439f0d10d7014fe9bc0d2fe22167cd3d0f5a5280a9d8953141d4583b4b6158

See more details on using hashes here.

File details

Details for the file tzview-0.3-py3-none-any.whl.

File metadata

  • Download URL: tzview-0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.9

File hashes

Hashes for tzview-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f39705e237c43283e0f472bed2428ae7b9de4d28f7f1aba8904eb794cd79c3ab
MD5 bd3b987c0bd36c1166d3537fa491fcdf
BLAKE2b-256 e76561e7c3db081cf4ece40fcc023430c6b2ef00bf774ec4551a59c39083c187

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