Snipget.ai

Parse a messy date string

Heuristic
dates_parse

Best-effort — fuzzy, approximate, or inferred; check the confidence score.

Parse a messy human date string ('March 5, 2024', '03/04/24') into ISO 8601 plus components. Heuristic: flags ambiguous values (is 03/04 March 4th or April 3rd?) and which fields it assumed, with a sub-1.0 confidence. Use dayfirst/yearfirst to steer the order. Absolute dates only: relative expressions — a weekday without an explicit day of month ('next tuesday', 'Friday June 2024') or 'tomorrow' — are rejected because the tool reads no clock and has no anchor date to resolve them against. An input missing its day of month ('3pm', 'June 2024') parses with the day as a placeholder at confidence 0.7; a missing year alone ('March 5') is the normal omission and keeps 0.9. A weekday that contradicts the resolved date ('Sun 15 Jun 2024' is a Saturday) sets weekday_conflict=true at confidence <= 0.5 — the explicit date wins, but the contradiction is flagged. Processing multiple inputs? Use `dates_parse_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

The messy date string to parse, e.g. 'March 5, 2024'.

dayfirstbooleanoptional

Interpret ambiguous DD/MM/YY as day-first.

yearfirstbooleanoptional

Interpret ambiguous values as year-first.

fuzzybooleanoptional

Extract a date from surrounding prose. Dropped tokens are returned in ignored_tokens and confidence is reduced; an implausible extracted year is flagged ambiguous.

Call it

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

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

Example response

{
  "input": "03/04/2024",
  "is_valid": true,
  "iso": "2024-03-04",
  "date": "2024-03-04",
  "time": null,
  "year": 2024,
  "month": 3,
  "day": 4,
  "hour": 0,
  "minute": 0,
  "second": 0,
  "weekday": "Monday",
  "has_time": false,
  "assumed_fields": [
    "hour",
    "minute",
    "second"
  ],
  "ambiguous": true,
  "weekday_conflict": false
}

FAQ

What does parse do?

It reads a messy human date string like 'March 5, 2024' or '03/04/2024' and turns it into a clean ISO date plus its parts (year, month, day, weekday). It is the front door for dates that are not already in a tidy format.

Why is this better than letting a model guess?

Language models silently pick one reading of an ambiguous date and move on. This tool flags the ambiguity instead. For 03/04/2024 it sets ambiguous to true and lowers the confidence, so you know to double-check whether it is March 4 or April 3.

This is best-effort, right?

Yes. Parse is heuristic, not exact, so always read the confidence score. A clean unambiguous date scores around 0.9; an ambiguous one like 03/04/2024 drops to about 0.6. Use dayfirst to tell it to read day-before-month.

Why does the result show a time I did not enter?

When your input has no time, parse fills the time fields with placeholder values and lists them under assumed_fields, with has_time set to false. Ignore the time portion and use the date when has_time is false.

What about a time with no date, like '3pm', or a partial date like 'June 2024'?

It parses, but the day of month (and anything else missing) is a deterministic placeholder listed under assumed_fields, so confidence is capped at 0.7. A missing year alone, like 'March 5', is the normal way people write dates and keeps full confidence.

What if the weekday I wrote does not match the date?

The explicit date wins, and the result sets weekday_conflict to true with confidence capped at 0.5. For example 'Sunday, June 15, 2024' resolves to 2024-06-15, which is a Saturday, so the disagreement is flagged instead of silently resolved. Check the weekday field for the actual day.

What if it cannot read the string at all?

You get is_valid false, confidence 0, and a why_invalid reason rather than an error. For dates you know are already clean ISO 8601, use the strict validate tool instead.

Can it resolve 'next tuesday' or 'tomorrow'?

No. Parse handles absolute dates only: a relative expression, including a weekday without an explicit day of month like 'next tuesday' or 'Friday June 2024', returns is_valid false with a why_invalid explaining that there is no anchor date. The tool never reads the clock, so it cannot know which Tuesday you mean.

Related tools