Skip to main content

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

Metadata

Release files for ts-toolkit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ts-toolkit 0.1.0
File Size Uploaded Provenance
ts_toolkit-0.1.0.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ts-toolkit 0.1.0
File Interpreter ABI Platform
ts_toolkit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / ts_toolkit-0.1.0.tar.gz

Download URL ts_toolkit-0.1.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e5729f6483605afba1a9d17e6a17d26d5deeb9ea4125e47232d2b710224f2b7f
BLAKE2b-256 checksum
How to use checksums
da972f2c7d537c32be533be0988ae46622d479f918bae76411a6e13fca2ba6c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / ts_toolkit-0.1.0-py3-none-any.whl

Download URL ts_toolkit-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3089d38ed6838f0868e9a6beb280fefdfd06b5d51eb5612caa0e16f83d129887
BLAKE2b-256 checksum
How to use checksums
2f08b4389f96375640634395a998dd2a6cf2dc5c3e4046b19e48ecc7eecfad74
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for ts-toolkit 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page