Skip to main content

Instant timestamp converter — zero-dependency CLI for epoch ↔ human-readable conversion

Project description

ts — Instant Timestamp Converter

Zero-dependency CLI tool for bidirectional epoch ↔ human-readable timestamp conversion.

Install

Option 1: curl (fastest)

curl -fsSL https://raw.githubusercontent.com/ericjoye/ts-cli/main/ts \
  -o /usr/local/bin/ts && chmod +x /usr/local/bin/ts

Option 2: pip

pip install ts-cli

Option 3: copy

cp ts /usr/local/bin/ts && chmod +x /usr/local/bin/ts

Requires Python 3.9+ (uses zoneinfo from stdlib). No pip dependencies.

Usage

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

Features

  • 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:SSZ and variants
  • Timezone support: --tz IANA_NAME or --local for system timezone
  • Batch mode: Multiple args or --stdin pipe
  • Zero dependencies: Single Python file, stdlib only

Running tests

pip install pytest
pytest test_ts.py -v

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ts_toolkit-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ts_toolkit-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file ts_toolkit-0.1.0.tar.gz.

File metadata

  • Download URL: ts_toolkit-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ts_toolkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e5729f6483605afba1a9d17e6a17d26d5deeb9ea4125e47232d2b710224f2b7f
MD5 2762b3641909a24773d3ac21cd6c78d1
BLAKE2b-256 da972f2c7d537c32be533be0988ae46622d479f918bae76411a6e13fca2ba6c1

See more details on using hashes here.

File details

Details for the file ts_toolkit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ts_toolkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for ts_toolkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3089d38ed6838f0868e9a6beb280fefdfd06b5d51eb5612caa0e16f83d129887
MD5 b5721ba799f8f12221af93e8073adf21
BLAKE2b-256 2f08b4389f96375640634395a998dd2a6cf2dc5c3e4046b19e48ecc7eecfad74

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page