Snipget.ai

Get calendar attributes of a date

Exact
dates_attributes

Deterministic and authoritative — the canonical answer for this input.

Calendar attributes of a date: leap year, days-in-month, ISO week, quarter, day-of-year, weekday, and weekend flag. Pass as_of (an ISO date) to also compute integer age_years at that reference. Processing multiple inputs? Use `dates_attributes_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

ISO 8601 date/datetime to describe.

as_ofstringoptional

Optional ISO date reference to compute integer age_years.

Call it

curl -X POST https://api.snipget.ai/v1/dates/attributes \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"2024-02-15"}'

The Batch tab sends up to 1000 inputs in one call via /v1/dates/attributes/batch.

Example response

{
  "input": "2024-02-15",
  "is_valid": true,
  "year": 2024,
  "month": 2,
  "day": 15,
  "weekday": "Thursday",
  "weekday_iso": 4,
  "is_weekend": false,
  "is_leap_year": true,
  "days_in_month": 29,
  "day_of_year": 46,
  "week_of_year": 7,
  "iso_week_year": 2024,
  "quarter": 1
}

FAQ

What does this tell me about a date?

Everything calendar-related in one call: the weekday, whether it is a weekend, whether the year is a leap year, how many days are in that month, the day of the year, the ISO week number, and the calendar quarter.

Why not work these out myself?

Things like leap years, the number of days in a month, and ISO week numbers have fiddly rules that are easy to get wrong. This tool computes them exactly, so reports and groupings line up.

Can it tell me someone's age?

Yes. Pass as_of with a reference date and the result adds age_years, the whole number of years between the date and that reference. It is left out unless you ask, so the tool never depends on today's date.

Is the output reliable?

Yes. It is deterministic and authoritative. The same date always returns the same attributes.

What if the date is invalid?

You get confidence 0 with a why_invalid reason instead of an error. Check is_valid in the response before using the values.

Related tools