https://github.com/yankeexe/timezones-cli
CLI toolkit for timezones :earth_asia:
https://github.com/yankeexe/timezones-cli
cli cli-app datetime python python-cli python-click timezone utc utc-datetime
Last synced: 10 months ago
JSON representation
CLI toolkit for timezones :earth_asia:
- Host: GitHub
- URL: https://github.com/yankeexe/timezones-cli
- Owner: yankeexe
- License: mit
- Created: 2020-10-05T04:32:25.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-02-23T11:56:26.000Z (11 months ago)
- Last Synced: 2025-03-29T07:09:01.809Z (10 months ago)
- Topics: cli, cli-app, datetime, python, python-cli, python-click, timezone, utc, utc-datetime
- Language: Python
- Homepage: https://pypi.org/project/timezones-cli/
- Size: 128 KB
- Stars: 73
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README

Timezones CLI
CLI toolkit for timezones:zap:

## What can you do with `timezones-cli`? :sparkles:
- 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](#installation)
- [Usage](#usage)
- [Search for timezones](#search-for-timezones)
- [Add/save timezones](#addsave-timezones)
- [Remove timezones](#remove-timezones)
- [Show saved timezones](#show-saved-timezones)
- [Select individual timezones from saved](#select-individual-timezones-from-saved)
- [Get UTC time](#get-utc-time)
- [Run using Docker :whale:](#run-using-docker-whale)
- [Contributing](#contributing)
## Installation
```bash
$ pip3 install timezones-cli
```
To run this CLI using Docker, check [Run using Docker :whale:](#run-using-docker-whale).
> **NOTE:** [List of country codes or timezone names](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) :earth_asia:
> **Use `-t` flag to toggle 24 hours format.**
## Usage
### Search for timezones
Get time based on the entered timezone or country code
- using country code (either 2 or 3 letters):
```bash
$ tz search US
$ tz search USA
```
- using timezone:
```bash
$ tz search Asia/Kathmandu
```
- using fuzzy text: (example: Ireland)
```bash
$ tz search Irela
```
- using timezone shortcodes (--zone or -z flag):
```bash
$ tz search pst -z
$ tz search ist -z
$ tz search jst -z
$ tz search cest -z
$ tz search +0543 -z
$ tz search +05 -z
```
Demo

---
### Add/save 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
```bash
$ 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.
```bash
$ tz remove -i
$ tz remove --name "Asia/Kathmandu"
```
Demo

---
### Show saved timezones
```bash
$ tz show
```
Demo

---
### Select individual timezones from saved
```bash
$ tz select
```
Demo

---
### Get UTC time
Get UTC time based on current system time.
> **tz utc --help**
```bash
$ tz utc
```
Get UTC time based on specified time and timezone.
```bash
$ tz utc
$ tz utc "11:45PM" "Asia/Kathmandu"
```
Demo

## Run using Docker :whale:
```bash
docker pull ghcr.io/yankeexe/timezones-cli:latest
```
Verify signature of the image: requires [cosign](https://docs.sigstore.dev/cosign/installation/).
```bash
COSIGN_EXPERIMENTAL=true cosign verify ghcr.io/yankeexe/timezones-cli:latest
```
Create a config file manually first.
```bash
$ 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:
```bash
$ 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.
```bash
$ 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](https://github.com/yankeexe/timezones-cli/blob/master/CONTRIBUTING.md).