Reference

CLI

The duration binary.

Synopsis

bash
duration [options] <value>

Examples

bash
$ duration 3600
3s 600ms

$ duration -m --unit=sec 3660
1 hr 1 min

$ duration --long --unit=min 90
1 hour 30 minutes

Options

  • -u, --unit=<unit> — input unit: ms (default), sec, min, hour, day
  • -s — short format (e.g. 1h 30m)
  • -m — medium format (e.g. 1 hr 30 mins)
  • -l — long format (e.g. 1 hour 30 minutes)
  • --json — output in JSON format
  • --table — output in tabular format
  • -h, --help — show help
  • -v, --version — show version

Environment

  • DURATION_UNIT — default value for --unit. Useful when piping through scripts so you don't have to repeat --unit=sec everywhere.

Installation

See Installation for npm, Homebrew, curl, GitHub Releases, and Go build options.