Zero-dependency CLI tool for bidirectional epoch ↔ human-readable timestamp conversion.
curl -fsSL https://raw.githubusercontent.com/ericjoye/ts-cli/main/ts \
-o /usr/local/bin/ts && chmod +x /usr/local/bin/tspip install ts-epochcp ts /usr/local/bin/ts && chmod +x /usr/local/bin/tsRequires Python 3.9+ (uses zoneinfo from stdlib). No pip dependencies.
ts # Current time: epoch (s/ms/μs) + UTC + local
ts 1718901234 # Epoch seconds → human
ts 1718901234000 # Epoch milliseconds → human (auto-detected)
ts 1718901234000000 # Epoch microseconds → human (auto-detected)
ts "2024-06-20T14:33:54Z" # ISO 8601 → epoch
ts "2024-06-20 14:33:54" # Human → epoch
ts now # Current epoch in seconds
ts 1718901234 1718902000 # Batch: multiple timestamps
cat timestamps.txt | ts --stdin # Pipe mode
ts 1718901234 --tz America/New_York # Convert to timezone
ts 1718901234 --local # Convert to local timezone- Auto-detection: Distinguishes seconds (≤10 digits), milliseconds (11–13), microseconds (16+)
- Bidirectional: Epoch → human AND human → epoch
- ISO 8601: Full support for
YYYY-MM-DDTHH:MM:SSZand variants - Timezone support:
--tz IANA_NAMEor--localfor system timezone - Batch mode: Multiple args or
--stdinpipe - Zero dependencies: Single Python file, stdlib only
pip install pytest
pytest test_ts.py -vMIT