Get local datetime from multiple timezones!
Project description
Timezones CLI
CLI toolkit for timezones:zap:
What can you do with timezones-cli
? :zap:
- Search for date and time based on city, country, or timezones.
- Manage dashboard for timezones you frequently view.
- Get UTC date and time based on your local timezone or any timezones.
Contents
Installation
$ pip3 install timezones-cli
To run this CLI using Docker, check Run using Docker :whale:.
NOTE: List of country codes or timezone names :earth_asia:
Use
-t
flag to toggle 24 hours format.
Usage
Search for local date time
You can use short country code like 'AE', 'RU', 'US' and so on.
You can search via city like: 'Paris', 'London', 'Moscow', 'Chicago' and so on.
$ tz search "us"
$ tz search "Nepal"
$ tz search "Paris"
Demo
Search based on timezone abbreviations
$ tz get "pst"
$ tz get "ist"
$ tz get "est"
$ tz get "cst"
Demo
Add timezones
Timezones added to the config file are treated as the default timezones which is triggered by the tz show
command.
file is stored at ~/.tz-cli
$ tz add "Asia/Kathmandu"
Demo
Remove timezones
There are two ways for removing timezones from the config file. Using the --interactive
mode and passing the the --name
flag.
$ tz remove -i
$ tz remove --name "Asia/Kathmandu"
Demo
Show local datetime of all saved timezones
$ tz show
Demo
Select a single timezone from defaults
$ tz select
Demo
Get UTC time
Get UTC time based on current system time.
tz utc --help
$ tz utc
Get UTC time based on specified time and timezone.
$ tz utc <time> <timezone>
$ tz utc "11:45PM" "Asia/Kathmandu"
Demo
Run using Docker :whale:
docker pull ghcr.io/yankeexe/timezones-cli:latest
Verify signature of the image: requires cosign.
COSIGN_EXPERIMENTAL=true cosign verify ghcr.io/yankeexe/timezones-cli:latest
Create a config file manually first.
$ touch ~/.tz-cli
$ docker run --rm -it -v ${HOME}/.tz-cli:/home/tz/.tz-cli ghcr.io/yankeexe/timezones-cli search us
For convenience you can add alias of the command to your shell config:
$ echo "alias tz='docker run --rm -it -v ${HOME}/.tz-cli:/home/tz/.tz-cli ghcr.io/yankeexe/timezones-cli'" >> ~/.bashrc
$ source ~/.bashrc
$ echo "alias tz='docker run --rm -it -v ${HOME}/.tz-cli:/home/tz/.tz-cli ghcr.io/yankeexe/timezones-cli'" >> ~/.zshrc
$ source ~/.zshrc
# Use alias to invoke timezones-cli
$ tz search Nepal
For local debugging: Use the make run
command followed by the command you want to run against the tz
binary.
$ make run cmd="get ist"
Demo
Contributing
For guidance on setting up a development environment and how to make a contribution to timezones-cli
, see the contributing guidelines.
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
File details
Details for the file timezones_cli-0.3.3.tar.gz
.
File metadata
- Download URL: timezones_cli-0.3.3.tar.gz
- Upload date:
- Size: 12.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e23261a21c7d2bac1137fc54fb72aa0aafb03c3dfa35dd6c006febea3e35c0b |
|
MD5 | ca9ca30e69c22e00c968706c003a26a1 |
|
BLAKE2b-256 | fea934bc6fd4ae810cfc41f17bf94e674a2c40755ee9a7eba62ce629a618fa10 |
File details
Details for the file timezones_cli-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: timezones_cli-0.3.3-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d3726b2d01eb03a90138e8e8e2231b73b4b3784fe5ebe8161940f0050848223 |
|
MD5 | 9d89f9525ccea5e29ab1855de15f731b |
|
BLAKE2b-256 | 75c117135ed395ccfbc3c6d87788e6bd79108e6d8815339f15a10cae07fc20d6 |