timezone

Crates.iotimezone
lib.rstimezone
version1.0.0
sourcesrc
created_at2024-04-26 20:25:48.95624
updated_at2024-04-29 22:46:41.027403
descriptionA CLI timezone converter.
homepage
repositoryhttps://github.com/LiquidZulu/timezone
max_upload_size
id1221770
size73,647
(LiquidZulu)

documentation

README

timezone (tz) - English Language Timezone Conversion

Table of Contents

  1. Installation
    1. Build from Source
    2. crates.io
  2. Usage
    1. As a Library
    2. As a CLI
      1. Arguments

      2. Required Arguments

Installation

Build from Source

The source code can be found at this GitHub repo. When the source has been obtained the easiest way to compile is with cargo build --release, then add path/to/timezone/target/release to your PATH. I do not know if this software compiles on Windows, if you have any problems with doing this open an issue.

crates.io

This software is distributed also at crates.io, and should be able to be installed with cargo install timezone.

Usage

As a Library

It should be possible to use this software in other rust programs with cargo add timezone. The majority of the actual conversion logic is handled by chrono-tz, but src/parse.rs provides several methods for parsing English-language inputs, which may be useful for you.

As a CLI

tz time origin_timezone destination_timezone day month year

For example:

tz 1pm et bst tomorrow

will tell you what 1pm eastern US time is in British summer time tomorrow.

Arguments

time

time should be in one of the following formats:

Format Examples
SimpleAmPm 1am, 10pm
FullAmPm 12:24am, 6:30pm
MilitaryColon 07:00, 13:52
Military 0900, 1634

origin_timezone and destination_timezone

The timezones can be either a city, such as Europe/London, America/Los_Angeles, or even US/Eastern; or a timezone abbreviation, such as gmt, est, aet. A full list of available abbreviations can be found by consulting src/convert_timezones.rs.

day, month, and year

day, month, and year are for the most part self-explanatory, but you can also specify today, tomorrow or yesterday for the day.

Required Arguments

This software is robust, you do not have to fully-specify the conversion that you want to perform. At a minimum you can specify only the time and the origin, with the rest being assumed to be your local timezone, the current day, the current month, and the current year.

Commit count: 21

cargo fmt