Calculate and convert times across time zones and cities of significant population.
Project description
Installation
Install from PyPI:
$ pip install when
or using pipx:
$ pipx install when
or:
$ pipx install git+https://github.com/dakrauth/when.git
Usage
To access city names, you must install the cities database:
when --db
You can specify minimum city size by adding --size SIZE, where SIZE can be one of:
15000 - cities with population > 15000 or capitals
5000 - cities with population > 5000 or seat of first-order admin division, i.e. US state
1000 - cities with population > 1000 or seat of third order admin division
500 - cities with population > 500 or seat of fourth-order admin division
Additionally, you can filter non-admin division seats using --pop POP.
The appropriate GeoNames Gazetteer is downloaded and a Sqlite database generated. Once installed, you can search the database:
$ when --db --search New York 5106292, West New York, West New York, US, New Jersey, America/New_York 5128581, New York City, New York City, US, New York, America/New_York
Additionally, you can add aliases. In the example directly above, we see that New York City has a GeoNames ID of 5128581. Pass that to the --alias option along with another name that you would like to use:
$ when --db --alias 5128581 NYC $ when --source NYC 2023-07-06 07:58:33-0400 (EDT, America/New_York) 187d27w (New York City, New York, US)[🌕 Full Moon]
Example
$ when
2023-07-06 20:58:02+0900 (KST, Asia/Seoul) 187d27w [🌕 Full Moon]
$ when --source CST
2023-07-06 06:58:54-0500 (CDT, Central Standard Time) 187d27w [🌕 Full Moon]
2023-07-06 15:58:54+0400 (+04, Caucasus Standard Time) 187d27w [🌕 Full Moon]
2023-07-06 19:58:54+0800 (CST, China Standard Time) 187d27w [🌕 Full Moon]
2023-07-06 07:58:54-0400 (CDT, Cuba Standard Time) 187d27w [🌕 Full Moon]
$ when --source Paris
2023-07-06 13:59:25+0200 (CEST, Europe/Paris) 187d27w (Villeparisis, Île-de-France, FR)[🌕 Full Moon]
2023-07-06 13:59:25+0200 (CEST, Europe/Paris) 187d27w (Paris, Île-de-France, FR)[🌕 Full Moon]
2023-07-06 13:59:25+0200 (CEST, Europe/Paris) 187d27w (Cormeilles-en-Parisis, Île-de-France, FR)[🌕 Full Moon]
2023-07-06 07:59:25-0400 (EDT, America/Port-au-Prince) 187d27w (Fond Parisien, Ouest, HT)[🌕 Full Moon]
2023-07-06 06:59:25-0500 (CDT, America/Chicago) 187d27w (Paris, Texas, US)[🌕 Full Moon]
$ when --source "San Francisco,US" --target America/New_York Mar 7 1945 7:00pm
1945-03-07 22:00:00-0400 (EWT, America/New_York) 066d10w [🌘 Waning Crescent]
1945-03-07 22:00:00-0400 (EWT, America/New_York) 066d10w [🌘 Waning Crescent]
Develop
Requirements Python 3.8+
$ git clone git@github.com:dakrauth/when.git
$ cd when
$ python -mvenv venv
$ . venv/bin/activate
$ pip install .
$ when --help
$ when --db
$ pip install tox
$ tox
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
Built Distribution
File details
Details for the file when-3.2.0.tar.gz
.
File metadata
- Download URL: when-3.2.0.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 00f28457c28dbdfa6e343aa9202935bbf7a06e171e5da57b8f54130dfdf677bb |
|
MD5 | 42eb927e4b33c45addbfff244e316204 |
|
BLAKE2b-256 | 146fb3b9ec120ab038495c02176d4b392888282caa429e4b91f44efeaf0ce775 |
File details
Details for the file when-3.2.0-py3-none-any.whl
.
File metadata
- Download URL: when-3.2.0-py3-none-any.whl
- Upload date:
- Size: 22.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12c2b16871f7a68576c3ed0057aaf1b530be22811a905ca16fb4ce6a982b5b09 |
|
MD5 | 62ac9e7a6f1f3ecf5493d1bc37c1b344 |
|
BLAKE2b-256 | f490ce55c53b73467bf5200c49242f4ba039d813b114aa554ebec15516ac8c2b |