Skip to the content

Dates and time zones

from (inclusive) and to (exclusive) are instant expressions: a point in time, or date math relative to one, documented in full at /docs/v1/instants. Both are evaluated with the same now, the time the request arrives, and from has to come out earlier than to, defaults included: an empty time frame, such as "from": "now" with no to, is refused with 400.

A script that sends only points in time needs nothing more than this. Each of these is an instant expression and means what it says:

  • now;
  • a date, 2026-09-03, which means midnight UTC at its start;
  • an RFC 3339  on another website date-time with at most three digits of fractional seconds, 2026-09-03T08:00:00.250+08:00.

Date math adds or subtracts a count of a unit (+, -) and rounds down to the start of a unit (/), from left to right: now-7d/d is midnight seven days ago, and 2026-09-03+M is 2026-10-03T00:00:00Z. All of this happens in UTC unless the expression names a time zone (see Time zones below).

The dates a document carries (date and dates) are instants in UTC too. The ones printed on a source page are read as China Standard Time (UTC+08:00), unless the page gives an offset of its own, so a page that prints 2026-09-03 without a time of day says 2026-09-02T16:00:00Z. added is not printed anywhere: we stamp it when we collect the page. How to show these dates, and how to choose from and to to match, is below.

dateField chooses which of a document's dates from and to filter on and the time histogram counts: date, the one date each document is treated as having, which is the default, or one of published, issued, implemented and added. Those four find only documents that have that date, so "dateField": "published" leaves out every document whose page gives no publication date. The ranking uses the chosen date too: with a term, relevance falls off with its distance from to, and without one, results come newest first by it.

Without from and to, a search covers the last seven days (now-7d to now) of the chosen date. To look further back, name from. How far back you may look depends on your organization's agreement; a from beyond it is refused with a 403 that says the earliest from you may use. The agreement also bounds how far ahead to may reach, and a to beyond that is refused the same way, with the latest to you may use. A saved search is held to both when it is saved and again each time it runs. Whatever dateField says, a search never finds a document whose date lies before that. It limits what a search finds, not what you can read: POST /v1/detail answers for any id, however old.

Time zones

A time zone in brackets right after the point in time makes the date math that follows happen in that zone: now[Europe/Berlin]/d is the start of today in Berlin. The zone is a name from the time zone database, spelled exactly as listed, or a fixed offset such as +08:00. It decides how the expression is worked out, and the result is an instant like any other.

  • now[Europe/Berlin] is now: a zone does not move a point in time.
  • A date, or a date-time without an offset, is read in the zone: 2025-01-01[Asia/Shanghai] is the start of that day in Shanghai, 2024-12-31T16:00:00Z.
  • A date-time with an offset is the instant the offset says, and the zone applies to the date math after it: 2026-09-29T09:39:49.933Z[Asia/Shanghai]/d is the start of that day in Shanghai, 2026-09-28T16:00:00Z.
  • Years, months, weeks and days (y, M, w, d) are counted on the calendar in the zone and keep the time of day, so now[Europe/Berlin]-d is this time yesterday in Berlin, 23 or 25 hours back when the clocks changed in between. Hours, minutes, seconds and milliseconds (h, m, s, ms) are exact: -24h is always 24 hours back.
  • Rounding goes to the first instant of the day, week (from Monday), month or year in the zone, and to the start of the hour, minute or second on its clock.

So these time frames are written as they sound:

Time framefromto
yesterday in Berlinnow[Europe/Berlin]-d/dnow[Europe/Berlin]/d
last month in Berlinnow[Europe/Berlin]-M/Mnow[Europe/Berlin]/M
today in Chinanow[Asia/Shanghai]/dnow[Asia/Shanghai]+d/d
2025 in China2025-01-01[Asia/Shanghai]2026-01-01[Asia/Shanghai]

from and to are separate expressions, each with its own zone, so name the same zone in both. A saved search keeps them as written: "last month in Berlin" is saved once and stays right whenever the clocks change.

A time of day the zone skips when its clocks go forward, such as 2026-03-29T02:30:00[Europe/Berlin], is refused with 400, as 2024-02-30 is. One that occurs twice when they go back means the first time; an offset picks the second: 2026-10-25T02:30:00+01:00[Europe/Berlin]. Date math never fails this way: landing in a gap moves on past it, and landing in a repeated hour takes the first time. A few zones change their clocks at midnight, so a day there can begin at 01:00: 2024-03-10[America/Havana] is that day's first instant, while 2024-03-10T00:00:00[America/Havana] names a time of day that did not occur.

Time zones change their rules now and then. We update the time zone database with our releases, and when a country changes its rules at short notice, results for the dates the change affects follow our update. A fixed offset never changes.

Showing a date, and choosing a range

An instant does not say how to show it. Choose a time zone by what the date is and by who reads it.

  • published, issued and implemented are dates the document bears in China. To show one as the page printed it, format it at UTC+08:00, the offset we read the pages at. (A time zone database's Asia/Shanghai agrees, except for some summers before 1992.) We cannot tell a page that printed only a date from one that printed midnight, so an instant at midnight in China is best shown as a date alone.
  • added is when we collected the page. What the time was in China then rarely matters; your readers' own time usually suits it better, but that depends on what you use it for.

Choose from and to in the time zone your readers think in, and show the dates in that same zone, or a document inside the range can seem to fall outside it. Say you build a spreadsheet or a dashboard of yesterday's documents for readers in Berlin: ask for yesterday in Berlin, and show the publication dates in Berlin time too. A column beside it can give the date as printed, in China. Yesterday in Berlin is "from": "now[Europe/Berlin]-d/d" and "to": "now[Europe/Berlin]/d".

The time histogram counts days, months and years in UTC unless it is given a zone: "histograms": {"time": {"timeZone": "Europe/Berlin"}} counts Berlin days. To count by the day a page printed, give it the offset we read pages at, and the printed date: "dateField": "published" with "histograms": {"time": {"timeZone": "+08:00"}}. A document printed with only the date 2026-09-04 then counts in the day that begins 2026-09-03T16:00:00Z.

The first and the last period end where the range does, so they are whole only when from and to are where a period begins. To count whole days, round both in the histogram's zone: the last 30 days in Berlin, per Berlin day, are "from": "now[Europe/Berlin]-30d/d" and "to": "now[Europe/Berlin]/d" with "histograms": {"time": {"timeZone": "Europe/Berlin"}}.