ForHosting KIT · Dates & time

Parse relative dates

From 10 January 2020 at 12:00 UTC, the phrase in 3 days becomes 13 January 2020 at 12:00 UTC. Type a short English or Spanish phrase and a reference moment to get the exact date and time it points to. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
in 3 days
Anchor
2020-01-10T12:00:00.000Z
You get
ISO date and time
2020-01-13T12:00:00.000Z
Unix timestamp (milliseconds)
1,578,916,800,000

Parse finite English/Spanish relative phrases into absolute ISO timestamps against an anchor.

From a phrase to an exact moment

People write dates relative to now all the time: in 3 days, in a few weeks, a while ago. A phrase like that has no fixed meaning until you say where it starts, which is why the tool asks for a reference moment. It then counts forward or back from that moment and gives you the exact result. The time of day carries over unchanged, so a phrase counted from noon still lands at noon: from 10 January 2020 at 12:00 UTC, in 3 days becomes 13 January 2020 at 12:00 UTC. You get the result both as a readable date and time and as a single number of milliseconds.

Getting reliable answers

The most common surprise comes from the reference moment. Counted from a different starting point, the same phrase points to a different day, so keep the reference with the result whenever it matters. The tool works with a limited set of short English and Spanish phrases rather than any sentence, and an empty phrase or a value that is not text is rejected before anything is calculated. Everything happens on your device with nothing looked up online, so the same phrase and the same reference moment always give the same answer, without a spreadsheet.

Edge cases and limits

Empty strings, wrong types, and contradictory ranges are rejected early. Civil dates without timezone are calendar dates. Embedded tables travel inside the capability folder with no network calls at runtime.

Review examples before integrating.

Daily work

Get a reliable answer without a spreadsheet.

What is a relative date?

It is an expression such as in 3 days that only makes sense from a starting point. On its own it names no day; with a reference moment it points to one exact date and time.

What is the reference moment for?

It is the instant the phrase counts from. The same phrase gives different results from different reference moments, so note which one you used if you need to repeat the calculation later.

Which languages can I write the phrase in?

English or Spanish. The tool understands a limited set of short relative phrases in those two languages rather than any sentence you like, which keeps every answer predictable.

What does the result contain?

The date and time in ISO format, such as 2020-01-13 at 12:00 UTC, and the same moment as a count of milliseconds, here 1578916800000, ready for a spreadsheet or another tool.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/date/relative-parse

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/date/relative-parse \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"in 3 days"}'
{
  "text": "in 3 days"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "date.relative_parse",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How it works

Parse finite English/Spanish relative phrases into absolute ISO timestamps against an anchor. The calculation is fully deterministic and runs free in your browser with the same pure function as the API. Inputs are validated before arithmetic so bad types become clear invalid_input errors. Additional guidance covers validation order, deterministic results, browser and API parity, stable error match strings for certification, and safe handling of out-of-range floating values. Additional guidance covers validation order, deterministic results, browser and API parity, stable error match strings for certification, and safe handling of out-of-range floating values.

Inputs and outputs

Optional fields use documented defaults. Required schema fields must be present and typed. Success payloads always include the primary output fields so UI bindings stay stable. Extremely large intermediates that overflow IEEE-754 become out-of-range errors rather than nulls. Additional guidance covers validation order, deterministic results, browser and API parity, stable error match strings for certification, and safe handling of out-of-range floating values. Additional guidance covers validation order, deterministic results, browser and API parity, stable error match strings for certification, and safe handling of out-of-range floating values.

Edge cases and limits

Additional guidance covers validation order, deterministic results, browser and API parity, stable error match strings for certification, and safe handling of out-of-range floating values. Additional guidance covers validation order, deterministic results, browser and API parity, stable error match strings for certification, and safe handling of out-of-range floating values.

Automation

Same pure function in widget and API.

Teaching

Stable golden fixtures for demos.

Is it free?

Yes, tier A in the browser.

Network?

No network; parse on-device.

Invalid input?

invalid_input with a clear match.

Stable?

Deterministic goldens freeze the contract.

Author?

samurai.

Read the full KIT documentation →