Skip to main content

Date Info API

REAL DATA

Real calendar facts for any date — weekday, ISO week, day of year, quarter, leap year, days in month, weekend flag and Unix timestamp. Defaults to today.

Authoritative reference data or standards computation

Base URL
/api/date-info
Category
Date & Time
Capabilities
1 route
Last updated
July 30, 2026
Data source

GET /api/date-info

Pure calendar arithmetic — only a bare call (no date) reads the clock, so responses for an explicit date are fully deterministic. The resolved date is echoed in meta.params.date.

Live requestRuns against the public API
No key required
GET/api/date-info

Request parameters

Date to analyze: YYYY-MM-DD, or an ISO 8601 timestamp (truncated to its UTC calendar date). Years 1583–9999. Defaults to today (UTC).

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/date-info"
const res = await fetch("https://randomapi.dev/api/date-info");
const { data, meta } = await res.json();
import requests

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

Date to analyze: YYYY-MM-DD, or an ISO 8601 timestamp (truncated to its UTC calendar date). Years 1583–9999. Defaults to today (UTC).

example: date=2026-06-11
Universal parameters Shared response and formatting options 4
fields list

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

example: fields=date,weekday
exclude list

Return all fields except these (comma-separated).

example: exclude=unix
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 10
date string (YYYY-MM-DD)

The resolved UTC calendar date the facts describe.

example: 2026-06-11

weekday string

English weekday name, Monday–Sunday.

example: Thursday

isoWeek integer

ISO 8601 week number (1–53). Weeks start Monday; week 1 is the week containing the year's first Thursday.

example: 24

isoWeekYear integer

ISO week-based year the week belongs to — differs from the calendar year around New Year (2021-01-01 → 2020).

example: 2026

dayOfYear integer

Ordinal day of the year: 1 (Jan 1) up to 365, or 366 in leap years.

example: 162

quarter integer

Calendar quarter, 1–4 (Q2 = April–June).

example: 2

isLeapYear boolean

Full Gregorian leap rule: divisible by 4, except centuries not divisible by 400 (2000 yes, 1900 no).

example: false

daysInMonth integer

Length of the date's month in days (28–31).

example: 30

isWeekend boolean

True when the weekday is Saturday or Sunday.

example: false

unix integer

Unix timestamp in seconds of the date at midnight UTC.

example: 1781136000

Documented examples

Build-generated requests and complete responses
3
Everything about today
GET /api/date-info
{
  "data": {
    "date": "2026-07-30",
    "weekday": "Thursday",
    "isoWeek": 31,
    "isoWeekYear": 2026,
    "dayOfYear": 211,
    "quarter": 3,
    "isLeapYear": false,
    "daysInMonth": 31,
    "isWeekend": false,
    "unix": 1785369600
  },
  "meta": {
    "endpoint": "date-info",
    "params": {
      "date": "2026-07-30"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Facts for a specific date
GET /api/date-info?date=2026-06-11
{
  "data": {
    "date": "2026-06-11",
    "weekday": "Thursday",
    "isoWeek": 24,
    "isoWeekYear": 2026,
    "dayOfYear": 162,
    "quarter": 2,
    "isLeapYear": false,
    "daysInMonth": 30,
    "isWeekend": false,
    "unix": 1781136000
  },
  "meta": {
    "endpoint": "date-info",
    "params": {
      "date": "2026-06-11"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Leap-year and month-length check
GET /api/date-info?date=2024-02-29&fields=date,isLeapYear,daysInMonth
{
  "data": {
    "date": "2024-02-29",
    "isLeapYear": true,
    "daysInMonth": 29
  },
  "meta": {
    "endpoint": "date-info",
    "params": {
      "date": "2024-02-29"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}

About this API

Coverage & behavior

Every field is pure Gregorian calendar arithmetic — real, deterministic facts with no datasets and no timezone guessing. Pass a date, or nothing to get today (UTC):

  • weekday plus isWeekend (true on Saturday and Sunday).
  • isoWeek / isoWeekYear per ISO 8601: weeks start on Monday and week 1 is the week containing the year's first Thursday. The week-year is not always the calendar year — 2021-01-01 falls in week 53 of 2020, while 2024-12-30 already belongs to week 1 of 2025.
  • dayOfYear (1–366), quarter (1–4) and daysInMonth (28–31).
  • isLeapYear using the full Gregorian rule — 2000 was a leap year, 1900 was not.
  • unix — seconds since the epoch at the date's midnight UTC.

Dates are treated as UTC calendar dates: an ISO timestamp input is truncated to its UTC date (with a warning so you notice), impossible dates like 2026-02-31 are rejected with a 400, and years outside 1583–9999 are refused — the Gregorian calendar simply didn't exist before October 1582, and pretending otherwise would return wrong data.

Use it for

  • Show ISO week numbers in planners, timesheets and sprint boards
  • Validate date input server-side: leap years, month lengths, impossible dates
  • Bucket analytics by quarter, ISO week or day of year without a date library
  • Disable weekends in delivery and booking date pickers

Frequently asked questions

What does it tell me about a date?

Weekday, ISO week and week-year, day of year, quarter, leap-year flag, days in the month, weekend flag and the Unix timestamp — all the calendar facts in one call.

Which date is used if I omit the parameter?

Today — so the bare route answers "what day is it today?" with the live date.

Why does the ISO week-year sometimes differ from the calendar year?

Around New Year, ISO 8601 assigns days to their week's year — January 1 can belong to week 52/53 of the previous ISO year. The API reports both so you don't have to compute it.