Coding

Epoch Time Convert

Try it

Convert between Unix epoch timestamps and human-readable datetimes, with timezone support and automatic unit detection (seconds/millis/micros/nanos). Use whe...

What it does

Convert between Unix epoch timestamps and human-readable datetimes, with timezone support and automatic unit detection (seconds/millis/micros/nanos). Use when a task involves reading or producing epoch timestamps, converting log timestamps to local time, computing the current epoch, or translating a date string into an epoch value.

The skill document

Epoch Time Convert

Overview

Convert Unix epoch timestamps to ISO datetimes and back, in any IANA timezone. The bundled script auto-detects whether an epoch value is in seconds, milliseconds, microseconds, or nanoseconds.

Quick Start

Run the script with one of three subcommands:

# Current time (UTC by default)
python3 scripts/epoch.py now --tz Asia/Shanghai

# Epoch -> ISO datetime (unit auto-detected)
python3 scripts/epoch.py to-human 1718000000 --tz UTC

# Datetime -> epoch seconds
python3 scripts/epoch.py to-epoch "2024-06-10 08:00:00" --tz Asia/Shanghai

Commands

  • now [--tz TZ] — print current epoch seconds, epoch millis, and ISO datetime.
  • to-human [--tz TZ] — convert an epoch value to an ISO datetime. Unit is auto-detected by magnitude (s / ms / µs / ns).
  • to-epoch "" [--tz TZ] — convert a datetime string to epoch seconds. Accepts YYYY-MM-DD[ T]HH:MM[:SS] and YYYY-MM-DD.

Notes

  • --tz accepts any IANA timezone name (e.g. UTC, Asia/Shanghai, America/New_York). Defaults to UTC.
  • Timezone support uses the standard-library zoneinfo (Python 3.9+). On older runtimes, only UTC is available.
  • For naive datetime input, the value is interpreted in the supplied --tz, not the machine's local time.

Related skills

Convert any time representation — unix timestamps (s/ms/us/ns), ISO 8601/RFC 3339/RFC 2822, strftime, spreadsheet serials, IANA timezones, natural language ("3 days ago"/"下周一"), date arithmetic, durations. Use for bare epoch numbers, timezone/format conversion, 时间戳转北京时间, or a whole time column.

Convert and format dates/times with zero external APIs — ISO 8601, Unix epoch, RFC 2822, and timezone conversion using only the local `date` binary and TZ database. Use when you need quick timestamp formatting, epoch conversion, duration arithmetic, or "what time is it in <city>" math without network calls.

2 installs

Convert time between different timezones using IANA timezone database. Supports 12/24-hour formats, specific dates, and automatic DST handling.

15 installs

使用 UAPI 的“时间戳转换”单接口 skill,处理 时间戳转换、Unix时间戳、日期转时间戳 等请求。 Use when the user wants get convert unixtime, convert unixtime, unixtime, or when you need to call GET...

22 installs

Web Data Convertor: Convert between web formats: JSON↔CSV, JSON↔XML, JSON↔YAML, Markdown↔HTML, query strings, Unix timestamps↔dates with timezone support. Us...

1 installs

Answers time and timezone questions with live data from the worldclock.pro MCP server. Use when the user asks what time it is in a city or country, converts a time between zones (9am EST in Tokyo, UTC to local), schedules a meeting or call across time zones, asks when clocks change for daylight savi