tww/README.md

55 lines
1.2 KiB
Markdown
Raw Normal View History

2019-03-13 23:02:54 +01:00
# Time when and where
Find time now, in the past or future in any timezone or location.
## Usage
```
python tz.py HUMAN_TIME [HUMAN_TZ_LOC]
```
* `HUMAN_TIME` - is any time or time-like string. See the [dateparser](https://pypi.org/project/dateparser/) for example `10:15`, `now`, `in 3 hours` and many others.
* `HUMAN_TZ_LOC` - (optional) is either timezone to which the date should be translated (fast) or a location (slow - and requires internet connection to resolve the location). Uses [geopy](https://geopy.readthedocs.io/en/stable/) for location resolution and [timezonefinder](https://pypi.org/project/timezonefinder/) for timezone resolution.
You could alias the whole command to `tww` for faster typing, e.g. in your `.bashrc`:
```
alias tww="~/workspace/tz/venv/bin/python ~/workspace/tz/tz.py"
```
If `HUMAN_TIME` and/or `HUMAN_TZ_LOC` have spaces, they need to be quoted, e.g.:
```
tww "in 2 hours" "los angeles"
```
## Install
```
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt
```
## Examples
Without timezone/location:
```
tww now
```
With timezone:
```
tww now cet
```
Time in timezone:
```
tww 15:10 cet
```
Time in location:
```
tww "3/14 15 9:26:53 PST" sofia
```
```