Open time API
Exact time for every IANA time zone and thousands of cities, as JSON. Free, no key, and open CORS, so you can call it straight from the browser.
Base URL
Every address starts with https://clockoftheworld.com/api/. Responses are UTF-8 JSON, and only GET is supported.
CORS and caching
Every response carries Access-Control-Allow-Origin: *, so the API can be used from any website. “Now” responses are cached for 5 seconds (Cache-Control: public, max-age=5), the zone list for a day and conversions for an hour. Error responses are never cached.
Fair use
This is a free service with no guarantees of uptime or response time. There is no fixed rate limit at the moment, but please be considerate: fetch the time once and keep counting in the browser with Date.now() rather than asking every second. We may limit access without notice if the service is abused.
Endpoints
The examples were generated for 2027-01-15T12:00:00Z. Real responses show the moment you ask.
Time in a time zone
Returns the clock time, offset, abbreviation, daylight saving status and next clock change for an IANA time zone. Zone names contain a slash, as in Europe/Oslo or America/New_York.
GET Example request
GET https://clockoftheworld.com/api/time/Europe/Oslo
| Parameters | |
|---|---|
<zone> | IANA time zone in the path, for example Europe/Oslo. |
Example response
{
"timezone": "Europe/Oslo",
"datetime": "2027-01-15T13:00:00.000+01:00",
"utc_datetime": "2027-01-15T12:00:00.000Z",
"unixtime": 1800014400,
"unixtime_ms": 1800014400000,
"utc_offset": "+01:00",
"offset_minutes": 60,
"abbreviation": "CET",
"dst": false,
"day_of_week": 5,
"day_of_year": 15,
"week_number": 2,
"next_transition": {
"at": "2027-03-28T01:00:00.000Z",
"offset_minutes_after": 120
}
}Time in a city
The same response as above, plus the name, country and position of the city. Give the city by the address segment (slug) used on our city pages, such as oslo or new-york.
GET Example request
GET https://clockoftheworld.com/api/time?city=oslo
| Parameters | |
|---|---|
city | The city’s address segment, for example oslo. |
Example response
{
"timezone": "Europe/Oslo",
"datetime": "2027-01-15T13:00:00.000+01:00",
"utc_datetime": "2027-01-15T12:00:00.000Z",
"unixtime": 1800014400,
"unixtime_ms": 1800014400000,
"utc_offset": "+01:00",
"offset_minutes": 60,
"abbreviation": "CET",
"dst": false,
"day_of_week": 5,
"day_of_year": 15,
"week_number": 2,
"next_transition": {
"at": "2027-03-28T01:00:00.000Z",
"offset_minutes_after": 120
},
"city": {
"name": "Oslo",
"country": "Norway",
"lat": 59.9167,
"lon": 10.75
}
}List of time zones
Every IANA time zone the service knows about. The example shows only the first three.
GET Example request
GET https://clockoftheworld.com/api/zones
Example response
{
"count": 418,
"zones": [
"Africa/Abidjan",
"Africa/Accra",
"Africa/Addis_Ababa",
"…"
]
}Convert between zones
Turns a clock time in one zone into the clock time in another, with full details for both. The calculation takes daylight saving on that date into account.
GET Example request
GET https://clockoftheworld.com/api/convert?time=2027-03-14T14:30&from=Europe/Oslo&to=America/New_York
| Parameters | |
|---|---|
time | Clock time in the from zone, as YYYY-MM-DDTHH:mm (seconds are optional). |
from | The time zone the clock time is in. |
to | The time zone you want the answer in. |
Example response
{
"from": {
"timezone": "Europe/Oslo",
"datetime": "2027-03-14T14:30:00.000+01:00",
"utc_datetime": "2027-03-14T13:30:00.000Z",
"unixtime": 1805031000,
"unixtime_ms": 1805031000000,
"utc_offset": "+01:00",
"offset_minutes": 60,
"abbreviation": "CET",
"dst": false,
"day_of_week": 7,
"day_of_year": 73,
"week_number": 10,
"next_transition": {
"at": "2027-03-28T01:00:00.000Z",
"offset_minutes_after": 120
}
},
"to": {
"timezone": "America/New_York",
"datetime": "2027-03-14T09:30:00.000-04:00",
"utc_datetime": "2027-03-14T13:30:00.000Z",
"unixtime": 1805031000,
"unixtime_ms": 1805031000000,
"utc_offset": "-04:00",
"offset_minutes": -240,
"abbreviation": "EDT",
"dst": true,
"day_of_week": 7,
"day_of_year": 73,
"week_number": 10,
"next_transition": {
"at": "2027-11-07T06:00:00.000Z",
"offset_minutes_after": -300
}
}
}Response fields
The time responses share the same fields. A conversion returns two such objects, from and to.
| Field | Description |
|---|---|
timezone | The name of the time zone (IANA). |
datetime | Local time in the zone, ISO 8601 with offset and milliseconds. |
utc_datetime | The same moment in UTC. |
unixtime | Seconds since 1 January 1970 (UTC). |
unixtime_ms | Milliseconds since 1 January 1970 (UTC). |
utc_offset | Offset from UTC as text, for example +01:00. |
offset_minutes | Offset from UTC in minutes. |
abbreviation | Abbreviation for the zone, for example CET. Some zones only have an offset such as GMT+4. |
dst | true when daylight saving time is in effect right now. |
day_of_week | Day of the week, 1 = Monday to 7 = Sunday. |
day_of_year | Day number in the year, starting at 1. |
week_number | ISO week number. |
next_transition | The next clock change within about a year: at (a UTC timestamp) and offset_minutes_after. null when the zone does not change its clocks. |
city | City lookups only: name, country, lat and lon. |
Errors
Errors return the right status code and a JSON object with error and status: 400 for missing or invalid parameters, 404 for an unknown zone, city or address, and 405 for methods other than GET.
Example error response
{
"error": "Unknown time zone: Mars/Olympus. See /api/zones for the list.",
"status": 404
}Example with fetch()
Fetch the time once and let the browser keep counting.
const res = await fetch('https://clockoftheworld.com/api/time/Europe/Oslo');
const t = await res.json();
console.log(t.datetime); // "2027-01-15T13:00:00.000+01:00"
console.log(t.utc_offset); // "+01:00"
console.log(t.dst); // false
// Keep counting in the browser without asking again
const skew = t.unixtime_ms - Date.now();
setInterval(() => console.log(new Date(Date.now() + skew).toISOString()), 1000);Try it
Enter a time zone and see the real response from the service.