Input (Unix timestamp, ISO date, or "now")
All examples use BASE_URL — set it to your deployment URL.
POST/api/timestamp
Convert between Unix timestamps, ISO dates, and relative time. Accepts 10-digit (seconds), 13-digit (ms), ISO strings, or "now".
const BASE_URL = "http://localhost:3000";
// From Unix timestamp:
const res = await fetch(`${BASE_URL}/api/timestamp`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ value: "1709683200" })
// Also: "now", "2024-03-06", or "1709683200000" (ms)
});
const data = await res.json();
// → { success: true, unix: 1709683200, unixMs: 1709683200000,
// iso: "2024-03-06T00:00:00.000Z", utc: "Wed, 06 Mar 2024...",
// local: "...", relative: "1y ago" }