Era
CLI tool for managing querying and manipulating date times written in
Go
Mirrored on GitHub at whiite/era from GitLab at monokuro/era
Install
Installation currently requires you have go installed on your system
To install:
go install gitlab.com/monokuro/era@latest
Usage
Use era help to see available commands and flags otherwise here are some examples:
# Prints the current time
era now
# Prints the current time as a unix timestamp
era now --formatter unix
# Prints the current date and time using Luxon and Moment formatting tokens in Tokyo's time zone
era now --timezone Asia/Tokyo --formatter luxon "h:mm d/L/yyyy"
era now --timezone Asia/Tokyo --formatter moment "h:mm D/M/Y"
# Parse and convert a time from one format to another
era parse --formatter unix 1746799240 --format iso # 2025-05-09T15:00:40+01:00
era parse --formatter iso 2025-05-09T15:00:40+01:00 --format moment "h:mm D/M/Y" # 3:00 9/5/2025
# Prints the available supported tokens and descriptions for the strptime/strftime formatter
era tokens --formatter strftime
# Convert and parse durations
era duration 90s --output minutes # 1.5
# Supports multiple units and separators
era duration 1h5_000ms --output ms --separator=_ # 3_605_000
# Prints help for the specific CLI command
era help <sub command>
More is planned to be added in the future as I come across them but these three
I've found I've used the most.
Correct escape sequences are supported for all
Note: Not every token is implemented fully yet. Most work as intended; some locale
specific formats are hardcoded to the UK or English versions but all are covered by tests
- moment
- Some locale specific formats may return slightly different strings to the real moment
- luxon
- Missing support for tokens:
ZZZZ - full offset name e.g. "Eastern Standard Time"
TTTT - Localised 24 hour time with full time zone name
f, ff, fff, ffff - localised date and time
F, FF, FFF, FFFF - localised date and time with seconds
- strftime (tokens used in a variety of languages including the
date CLI)
- Full compatibility via C FFI bindings to the
strftime function
- An alternative Go implementation (using
go:strftime as the formatter)
- Missing true locale support with some tokens such as
%Ec, %c currently hardcoded to the UK representation
- go (time package format)
- Full support as this CLI tool is written in Go and uses the standard library time package
Compatibility table
| Feature |
Go |
strftime/strptime |
Go strftime/strptime |
Luxon |
Moment |
| Formatting with tokens |
All ✅ |
All ✅ |
All ✅ |
Most |
All ✅ |
| Token descriptions |
All ✅ |
All ✅ |
All ✅ |
All ✅ |
All ✅ |
| Locale support |
N/A |
Yes ✅ |
Some |
Some |
Some |
| Parsing tokens |
All ✅ |
All ✅ |
Some |
No ❌ |
No ❌ |
Under consideration