一個時間,說清楚。 批次轉換 城市 UTC 計時器 玩 關於

API

公開時間 API(v1)

提供目前瞬間、格式轉換與時區轉換的 JSON 介面。CORS *,v1 無需 API 金鑰。限流:每個 IP 每 60 秒 120 次請求;超出後回傳 HTTP 429,並附 Retry-After 標頭。請勿用於安全關鍵計時。

GET /api/v1/now

查詢參數:format(iso | unix | unix_ms | rfc2822 | http | custom)、tz(IANA)、自訂時可選 pattern(YYYY MM DD HH mm ss Z X x)。

curl "https://time.foo/api/v1/now?format=iso&tz=Asia/Singapore"

GET /api/v1/convert

查詢參數:from(ISO 或 unix 秒/毫秒)、from_tz、to_tz、format,可選 pattern。

curl "https://time.foo/api/v1/convert?from=1700000000&to_tz=America/New_York&format=iso"

GET /api/v1/timezone

查詢參數:可選 time、from_tz、to_tz — 回傳兩個時區的偏移與 ISO 標籤。

curl "https://time.foo/api/v1/timezone?from_tz=UTC&to_tz=Asia/Tokyo"

探索

GET /api/v1/ 回傳 JSON 索引。錯誤形如 {"error":"bad_request","message":"..."}。

未知的查詢參數會回傳 400,並列出可用參數(例如 /timezone 使用 from_tz 與 to_tz,不是 tz)。

相關:轉換器、嵌入時鐘、關於時間。