Discover, install, and configure shell plugins with Fig Plugin Store →
🕑

Pretty Time Zsh

Convert seconds to a human readable string: `165392` → `1d 21h 56m 32s`

sindresorhus
|
67 stars
7 forks

Convert seconds to a human readable string: 1653921d 21h 56m 32s

Usage

$ date +%s
1407771536

$ pretty-time 165392
1d 21h 56m 32s

# seconds since epoch - yesterday since epoch + 11111 seconds
$ pretty-time "$(date +%s) - $(date -v-1d +%s) + 11111"
1d 3h 5m 11s

See pretty-ms for a JavaScript version that converts from milliseconds.

License

MIT © Sindre Sorhus