Time utilities - UTC offsets and zones

Time APIs

Get the current ISO 8601 datetime for a time zone, an offset or an IP address, a Unix timestamp, a microsecond timestamp or a list of IANA timezones. All of them answer a plain GET request.

  • No API key
  • Seven endpoints
  • Offset filtering
  • JSON response

Current time and zones

GET/datetime /ip_datetime /timestamp

GET/microtimestamp /timezones

https://aisenseapi.com/services/v1

Datetime by zone or UTC offset

Without an argument, /datetime returns the current datetime in UTC. Add an IANA zone such as europe/oslo, in any case, which follows summer time, or a four-digit offset for a fixed shift.

curl https://aisenseapi.com/services/v1/datetime/europe/oslo

{"datetime":"2026-10-31T17:15:04+01:00","timezone":"Europe/Oslo","abbreviation":"CET","utc_offset":"+01:00","dst":false,"unixtime":1793463304,"raw_offset":3600,"dst_offset":0,"dst_from":null,"dst_until":null,"day_of_week":6,"day_of_year":304,"week_number":44,"utc_datetime":"2026-10-31T16:15:04+00:00"}
curl https://aisenseapi.com/services/v1/datetime/+0200

{ "datetime": "2026-08-16T11:44:35+02:00" }

An offset is four digits with an optional sign, or the same with a colon. Valid examples are +0200, -0530, 0100 and +02:00. An hour-only value such as 1 does not match the route. An unknown zone name is HTTP 400 with a fix.

Datetime where an address is

/ip_datetime answers the same fields as /datetime/{zone} for the zone an IPv4 or IPv6 address is in, with the address first. Without an address it uses the caller's own.

curl https://aisenseapi.com/services/v1/ip_datetime/8.8.8.8

{"ip":"8.8.8.8","datetime":"2026-11-01T04:59:25-06:00","timezone":"America/Chicago","abbreviation":"CST","utc_offset":"-06:00","dst":false, ...}

The zone comes from an address lookup and is approximate. A device that knows its zone does better to ask by name. More on the IP datetime page.

Moving from WorldTimeAPI

On 3 October 2026 every connection we made to worldtimeapi.org was reset. Its fields answer here under this API's own paths: /api/timezone/{zone} is /datetime/{zone}, /api/ip is /ip_datetime, and /api/timezone is /timezones. Only HTTPS is served, and every answer is JSON. The WorldTimeAPI alternative page has the translation table, what differs and the ESP32 change.

Unix timestamp and microtimestamp

Timestamp

GET/timestamp

{ "timestamp": 1786873261 }

Whole seconds since the Unix epoch.

Microtimestamp

GET/microtimestamp

{ "microtimestamp": 1786873474.745043 }

Unix time with fractional seconds.

Timezone list and offset filter

/timezones returns IANA timezone names and their current offsets. Add a four-digit offset to filter the list.

curl https://aisenseapi.com/services/v1/timezones/+0200

{
  "timezones": [
    { "timezone": "Africa/Blantyre", "offset": "+0200" },
    { "timezone": "Europe/Oslo", "offset": "+0200" }
  ]
}

The timezones value is an array of objects. It is not an array of strings. Offsets can change with daylight-saving rules, so read the returned value instead of storing a permanent assumption.

When a cron expression fires next

/cron takes a five-field cron expression, percent-encoded in the path, and answers the next times it fires in a zone: each as a timestamp, as local time with its offset, as UTC and with its weekday. Lists, ranges, steps, names and the @daily family of macros are accepted. It computes only and schedules nothing.

curl "https://aisenseapi.com/services/v1/cron/0%209%20*%20*%201-5/2/Europe/Oslo"

{
  "expression": "0 9 * * 1-5",
  "zone": "Europe/Oslo",
  "count": 2,
  "next": [
    { "timestamp": 1794211200, "datetime": "2026-11-09T09:00:00+01:00", "utc_datetime": "2026-11-09T08:00:00Z", "weekday": "Monday" },
    { "timestamp": 1794297600, "datetime": "2026-11-10T09:00:00+01:00", "utc_datetime": "2026-11-10T08:00:00Z", "weekday": "Tuesday" }
  ]
}

POST the same as JSON with expression, count (1 to 100), zone and from for a fixed starting point.

Swatch Internet Time

This endpoint divides the day into 1000 beats based on Biel Mean Time.

curl https://aisenseapi.com/services/v1/swatchinternettime

{ "beat": "@444", "date": "2026-08-16" }

beat is a string that begins with @.

Convert between time formats

POST /timestamp_convert takes one value - unix seconds, unix milliseconds (13 digits and up, detected automatically), ISO 8601, RFC 2822 or "now" - and returns every representation, with an optional four-digit offset for the datetime output. Bad input returns HTTP 400.

curl -X POST https://aisenseapi.com/services/v1/timestamp_convert 
  -H "Content-Type: application/json" -d '{"data": "1700000000123", "offset": "+0100"}'

{ "detected": "unix_ms", "timestamp": 1700000000,
  "datetime": "2023-11-14T23:13:20+01:00", "utc_datetime": "2023-11-14T22:13:20+00:00" }

Common uses

Workflow timestamps

Add a shared server-side timestamp to an automation result.

Timezone selection

Build a list of zones that currently share a given UTC offset.

Scheduling input

Convert a user-selected offset into an ISO 8601 value.

Testing

Fetch a current value when test code needs time from an external source.

Response and error handling

The response key matches the endpoint name. Errors return {"error": "..."} with a real HTTP status - 400 for bad input, 404 for unknown paths and ids. The service-wide limit is 5000 requests per IP per day.