Skip to main content

Current Time API

REAL DATA

Current time in any IANA timezone — UTC instant, unix seconds, local date & time, UTC offset, ISO week, day of year and a live DST flag.

Authoritative reference data or standards computation

Base URL
/api/time
Category
Date & Time
Capabilities
1 route
Last updated
July 29, 2026
Data source

GET /api/time

Live: every call reads the server clock (iso/unix are the same instant for every tz). All local fields are derived from the zone's rules at that exact instant.

Live requestRuns against the public API
No key required
GET/api/time

Request parameters

IANA timezone id (e.g. Europe/Copenhagen, America/New_York), matched case-insensitively. Unknown ids return a 400 — browse valid ids at /api/timezones.

Advanced response options4 options

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/time"
const res = await fetch("https://randomapi.dev/api/time");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/time").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/time"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 1
tz string

IANA timezone id (e.g. Europe/Copenhagen, America/New_York), matched case-insensitively. Unknown ids return a 400 — browse valid ids at /api/timezones.

default: UTC
example: tz=Europe/Copenhagen
Universal parameters Shared response and formatting options 4
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=iso,unix
exclude list

Return all fields except these (comma-separated).

example: exclude=dst
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 12
iso string (ISO 8601)

The current instant in UTC, with milliseconds. Identical no matter which tz you ask for.

example: 2026-06-11T14:30:45.123Z

unix integer

Seconds since the Unix epoch (UTC, floored to the whole second).

example: 1781188245

timezone string

Canonical IANA id of the zone that was applied (case-corrected from your input).

example: Europe/Copenhagen

localDate string (YYYY-MM-DD)

Wall-clock date in the requested zone.

example: 2026-06-11

localTime string (HH:MM:SS)

Wall-clock time in the requested zone, 24-hour clock.

example: 16:30:45

weekday string

English weekday name of the local date.

example: Thursday

utcOffset string (±HH:MM)

The zone's UTC offset at this instant, DST-aware (e.g. +02:00, -04:00, +05:45).

example: +02:00

offsetMinutes integer

The same offset in minutes — negative west of UTC (e.g. -300 for New York in winter).

example: 120

isoWeek integer

ISO 8601 week number (1–53) of the local date.

example: 24

isoWeekYear integer

ISO week-based year of the local date — can differ from the calendar year around New Year.

example: 2026

dayOfYear integer

Ordinal day of the local calendar year (1–366).

example: 162

dst boolean

Whether daylight saving time is in effect in the zone at this instant.

example: true

Documented examples

Build-generated requests and complete responses
3
Current time in UTC
GET /api/time
{
  "data": {
    "iso": "2026-07-29T08:13:22.000Z",
    "unix": 1785312802,
    "timezone": "UTC",
    "localDate": "2026-07-29",
    "localTime": "08:13:22",
    "weekday": "Wednesday",
    "utcOffset": "+00:00",
    "offsetMinutes": 0,
    "isoWeek": 31,
    "isoWeekYear": 2026,
    "dayOfYear": 210,
    "dst": false
  },
  "meta": {
    "endpoint": "time",
    "params": {
      "tz": "UTC"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Local time in Copenhagen
GET /api/time?tz=Europe/Copenhagen
{
  "data": {
    "iso": "2026-07-29T08:13:22.000Z",
    "unix": 1785312802,
    "timezone": "Europe/Copenhagen",
    "localDate": "2026-07-29",
    "localTime": "10:13:22",
    "weekday": "Wednesday",
    "utcOffset": "+02:00",
    "offsetMinutes": 120,
    "isoWeek": 31,
    "isoWeekYear": 2026,
    "dayOfYear": 210,
    "dst": true
  },
  "meta": {
    "endpoint": "time",
    "params": {
      "tz": "Europe/Copenhagen"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}
Tokyo clock, minimal payload
GET /api/time?tz=Asia/Tokyo&fields=localDate,localTime,utcOffset
{
  "data": {
    "localDate": "2026-07-29",
    "localTime": "17:13:22",
    "utcOffset": "+09:00"
  },
  "meta": {
    "endpoint": "time",
    "params": {
      "tz": "Asia/Tokyo"
    },
    "generatedAt": "2026-07-29T08:13:22.000Z"
  }
}

About this API

Coverage & behavior

The live server clock, answered in any timezone. One call returns the UTC instant (iso, unix) plus the full local-calendar picture for the requested zone: wall-clock localDate/localTime, weekday, the current utcOffset (as ±HH:MM and as offsetMinutes), ISO isoWeek/isoWeekYear, dayOfYear, and whether daylight saving time is in effect right now (dst).

The details that are easy to get wrong are handled correctly:

  • tz is a real IANA id, matched case-insensitively (europe/copenhagen works) and echoed back in canonical form. An unknown id is a 400 pointing at /api/timezones for the full list — never a silent fallback to UTC.
  • Offsets are live, not static. utcOffset, offsetMinutes and dst reflect the zone's rules at this exact instant: Copenhagen flips between +01:00 and +02:00 at the EU DST transitions, southern-hemisphere zones report DST in January, and sub-hour zones like Asia/Kathmandu come out exact (+05:45, offsetMinutes: 345).
  • Calendar fields follow the local date, not the UTC date. Shortly after midnight in Tokyo, weekday, dayOfYear, isoWeek and isoWeekYear already belong to the new local day even though UTC is still on the previous one — and around New Year isoWeekYear can legitimately differ from the calendar year.

This is real, live data: two calls return two different times. For random fake dates and calendar facts about arbitrary dates, use the other date & time endpoints instead.

Use it for

  • Get a trustworthy server-side clock for clients whose local time can't be trusted
  • Show the current local time of a remote office or city without doing timezone math yourself
  • Branch scheduling/cron logic on the live UTC offset and DST state (offsetMinutes, dst)

Frequently asked questions

How do I get the current time in a timezone?

/api/time?tz=America/New_York — UTC instant, Unix seconds, local date and time, UTC offset and a live dst flag in one response.

Is the clock actually live?

Yes — this endpoint reads the real clock on every request. It's one of the platform's few non-seeded routes: "now" means now.

Which timezone names work?

Any IANA zone id (Europe/Copenhagen, Asia/Tokyo…). Unknown ids get an honest error, never a silent UTC fallback.

Standards & references