Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ptrbrynt/timey
A command line utility for parsing and formatting timestamps, written in Rust.
https://github.com/ptrbrynt/timey
command-line rust rust-crate
Last synced: 3 months ago
JSON representation
A command line utility for parsing and formatting timestamps, written in Rust.
- Host: GitHub
- URL: https://github.com/ptrbrynt/timey
- Owner: ptrbrynt
- License: mit
- Created: 2019-03-05T14:37:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-11T08:40:50.000Z (almost 6 years ago)
- Last Synced: 2024-08-10T09:13:26.416Z (6 months ago)
- Topics: command-line, rust, rust-crate
- Language: Rust
- Size: 30.3 KB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Timey
[![Build Status](https://travis-ci.org/ptrbrynt/timey.svg?branch=develop)](https://travis-ci.org/ptrbrynt/timey)
![Crates.io](https://img.shields.io/crates/v/timey.svg)
![Crates.io](https://img.shields.io/crates/d/timey.svg)
![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/ptrbrynt/timey.svg)
![Crates.io](https://img.shields.io/crates/l/timey.svg)Timey is a command-line application written in Rust which allows for quick and easy translation between timestamps and formatted date-times.
## Installation
First you'll need to install Rust. There are instructions [here](https://www.rust-lang.org/tools/install).
Once you have Rust installed, simply run:
```bash
cargo install timey
```## Usage
### Parse a date-time string into a timestamp
```bash
$ timey parse '2019-03-05 00:00 +0100' --format '%Y-%m-%d %H:%M %z'
1551744000
``````bash
$ timey parse '2019-03-05T00:00+01:00'
1525521780
```### Format a timestamp as a date-time string
```bash
$ timey format 1525521780
2019-03-05T00:00+01:00
``````bash
timey format 1525521780 -f '%Y-%m-%d'
2018-05-05
```### Formatting Options
For a full list of formatting specifiers, see [here](https://docs.rs/chrono/0.4.6/chrono/format/strftime/index.html#specifiers).
### Options
```bash
-c, --copy # Copy the result to your the clipboard
-f, --format # The date format to use for parsing/formatting
-m, --millis # Use timestamps in millis rather than seconds
-h, --help # Display help
```## Display Current Time
_The `-c` flag for copying the result to the clipboard also works with these commands._
### As a timestamp
```bash
$ timey now display
1551908316
``````bash
$ timey now display -m
1551908316000
```### As a formatted date-time string
```bash
$ timey now format
2019-03-06T21:38:30.265352+00:00
``````bash
$ timey now format -f '%Y-%m-%d'
2019-03-06
```