Make naive datetime objects timezone aware using city names
Project description
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.
-
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
Noneon 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tzconvert-0.0.1.tar.gz.
File metadata
- Download URL: tzconvert-0.0.1.tar.gz
- Upload date:
- Size: 1.6 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cecc665ae096aa2140f8bbd05a2f22bad939ab49be1ef62682e84170f6b5921
|
|
| MD5 |
d4afcbb6bcc693f9bf53d93f2fdc212b
|
|
| BLAKE2b-256 |
3437ab62e264294546c20f5767264c596ba01e6392b67ee2a9859d7b31f913be
|
File details
Details for the file tzconvert-0.0.1-py3-none-any.whl.
File metadata
- Download URL: tzconvert-0.0.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0508da5f41bdc57a1c48874c5b8b940dcfa0f471988f458dc9adbd320c69cad1
|
|
| MD5 |
5892801b7e4af9fd58a40f6104f3919b
|
|
| BLAKE2b-256 |
861acc36f8ac84a006d31bcfb93677cad24d59b4426a7f651da228cb6357f3b8
|