Skip to main content

Make naive datetime objects timezone aware using city names

Project description

PyPI version

tzconvert

tzconvert is a simple library for converting a naive, timezone unaware datetime object to it's smarter, timezone aware version.

Installation

Installation is straightforward.

pip install tzconvert

Installing from sources

  • Clone this git repository.

  • cd into the project folder.

  • run python setup.py install

Usage

>>> import tzconvert
>>> import datetime

>>> naive_datetime = datetime.datetime.utcnow()

>>> naive_datetime
datetime.datetime(2020, 4, 21, 22, 36, 27, 945535)

>>> adjusted_datetime = tzconvert.adjust_datetime(naive_datetime, "Venice")

>>> adjusted_datetime
datetime.datetime(2020, 4, 22, 0, 36, 27, 945535, tzinfo=tzoffset('GMT', 7200))

NOTES :

  • adjust_datetime() returns None on failure.
  • adjust_datetime() takes an optional argument debug, set it to True to display debug messages on stdout.

PR's are more than welcome.

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

tzconvert-0.0.2.tar.gz (1.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tzconvert-0.0.2-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

Details for the file tzconvert-0.0.2.tar.gz.

File metadata

  • Download URL: tzconvert-0.0.2.tar.gz
  • Upload date:
  • Size: 1.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.5.2

File hashes

Hashes for tzconvert-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c10a083cfe56673f0e95b738a456d699378487b1ffa73926af7986f8d818cc82
MD5 f260c74cb6435259c0b0aa5f39c581ff
BLAKE2b-256 230433b0f85b8744b1a46416ad7ec9c33c2795be516df9c6292dee8479d5b1c6

See more details on using hashes here.

File details

Details for the file tzconvert-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: tzconvert-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 2.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.1.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.5.2

File hashes

Hashes for tzconvert-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 28a41da70e9d4a639665a46268c1c46339ed46d00b442432ff9f73a86674fe17
MD5 b09df9683d83b2a3a5a0d1793894d610
BLAKE2b-256 f6ba4e3e21c5816fe44d91085eab7166fe65091b0619b02744a4ad7054805420

See more details on using hashes here.

Supported by

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