Skip to content
MarketCalendars.com
Sign up

API documentation

REST API v2: trading hours, holidays and settlement days as JSON over HTTPS

Convert a timestamp or date

GET/api/v2/time/convert

Reads a Unix timestamp, date string or relative time and returns it as Unix time in every unit, ISO 8601 in UTC and in a zone, RFC 9557 and RFC 2822. Free, no key needed. Precision is kept to the nanosecond

Free: no key needed and not counted towards your quota. Limited to 60 requests per minute per IP address

Parameters

NameInDescription
valuerequiredqueryA Unix timestamp (1793967600, 1793967600123, -86400, 1793967600.5), a date string (ISO 8601, RFC 3339, RFC 9557, RFC 2822, HTTP date, 2026-11-06 14:30, 6 Nov 2026, 11/06/2026) or a relative time (now, today, +90m, 3 days ago)Example: 1793967600
unitoptionalqueryUnit of a numeric value. auto reads it from the size: below 10^11 seconds, below 10^14 milliseconds, below 10^17 microseconds, otherwise nanoseconds
tzoptionalqueryIANA time zone for zone. Defaults to UTCExample: America/New_York
inoptionalqueryIANA time zone for date strings without an offset, and for today, yesterday and tomorrow. Defaults to UTCExample: America/New_York
disambiguationoptionalqueryFor a local time that happens twice when clocks go back: the earlier or later instant, or reject with an error. Times skipped when clocks go forward move forward by the gap unless this is reject
orderoptionalqueryHow to read slashed dates such as 05/08/2026 when either part could be the day

Example

curl "https://marketcalendars.com/api/v2/time/convert?value=1793967600&tz=America/New_York"
GET /api/v2/time/convert?value=1793967600&tz=America/New_York200
{
  "input": "1793967600",
  "detected": {
    "kind": "timestamp",
    "unit": "s",
    "format": "Seconds",
    "zone": null
  },
  "seconds": 1793967600,
  "milliseconds": 1793967600000,
  "microseconds": "1793967600000000",
  "nanoseconds": "1793967600000000000",
  "utc": "2026-11-06T12:20:00Z",
  "zone": {
    "id": "America/New_York",
    "local": "2026-11-06T07:20:00-05:00",
    "rfc9557": "2026-11-06T07:20:00-05:00[America/New_York]",
    "rfc2822": "Fri, 06 Nov 2026 07:20:00 -0500",
    "offset": "-05:00",
    "abbreviation": "EST",
    "dst": false
  },
  "calendar": {
    "weekday": "Friday",
    "isoWeek": "2026-W45",
    "dayOfYear": 310
  },
  "notes": [],
  "alternatives": [
    {
      "unit": "ms",
      "utc": "1970-01-21T18:19:27.600Z"
    },
    {
      "unit": "us",
      "utc": "1970-01-01T00:29:53.967600Z"
    },
    {
      "unit": "ns",
      "utc": "1970-01-01T00:00:01.793967600Z"
    }
  ]
}

A live response from the API. Lists longer than seven items are cut to three here

Response fields

TimeConversion object. Fields marked | null are always present and may be null

FieldTypeDescription
inputstringThe value as sent
detectedobjectHow the value was read
detected.kindstringWhat the value was read astimestampdaterelative
detected.unitstring | nullUnit of a timestamp; null otherwisesmsusns
detected.formatstringThe format that was read, for people
detected.zonestring | nullZone a local time was read in; null when the value carried its own offset
secondsintegerUnix time in whole seconds, rounded down
millisecondsintegerUnix time in whole milliseconds, rounded down
microsecondsstringUnix time in microseconds. A string, as it exceeds 2^53
nanosecondsstringUnix time in nanoseconds, exact. A string, as it exceeds 2^53
utcstring (date-time)ISO 8601 in UTC, with as many fraction digits as the value needs (0, 3, 6 or 9)
zoneobject
zone.idstringIANA time zone
zone.localstring (date-time)ISO 8601 in the zone, with its UTC offset
zone.rfc9557stringISO 8601 with the offset and the zone in brackets (RFC 9557)
zone.rfc2822stringRFC 2822 date in the zone, whole seconds
zone.offsetstringUTC offset, ±HH:MM (±HH:MM:SS for local mean time before standard time)
zone.abbreviationstringZone abbreviation, or GMT±H where there is no common one
zone.dstbooleanWhether summer time is in force
calendarobjectCalendar facts in the zone
calendar.weekdaystringWeekday in the zone
calendar.isoWeekstringISO 8601 week in the zone
calendar.dayOfYearintegerDay of the year in the zone, 1 to 366
notesobject[]Anything worth knowing about how the value was read. Usually empty
notes[].typestringKind of notenonexistent-timeambiguous-timeday-firstmonth-firstleap-second
notes[].detailstringWhat happened, for people
alternativesobject[] | nullFor timestamps with unit=auto, the value read in each other unit. Null otherwise
alternatives[].unitstringsmsusns
alternatives[].utcstring | nullThe value read in this unit, or null outside the years 1 to 9999

Errors

  • 400invalid-parameterA path or query parameter is malformed, such as a date that is not YYYY-MM-DD
  • 400unreadable-valueThe value is not a timestamp, date or relative time we can read, or is outside the years 1 to 9999
  • 400invalid-local-timeWith disambiguation=reject, the local time falls in a clock change: it never happens or happens twice
  • 429rate-limitedThe key sent more requests in a minute than its plan's burst limit, or the client sent too many invalid keys