Instant expressions
On this page
An instant expression names one point in time. It is a date, a date and time, or now,
optionally in a time zone, and optionally followed by date math: now-7d/d is midnight seven
days ago, and now[Europe/Berlin]-7d/d is midnight seven days ago in Berlin. The website and the API
take an instant expression wherever they ask for a point in time, most often as the two ends of a
timeframe, from and to.
At a glance
Every example on this page is evaluated with now at 2026-09-25T14:37:12Z, a Friday afternoon,
and every result is shown in UTC.
now 2026-09-25T14:37:12Z
now-24h 2026-09-24T14:37:12Z
now-7d 2026-09-18T14:37:12Z
now/d 2026-09-25T00:00:00Z
now-d/d 2026-09-24T00:00:00Z
now-7d/d 2026-09-18T00:00:00Z
now/w 2026-09-21T00:00:00Z
now/M 2026-09-01T00:00:00Z
now-6M/M 2026-03-01T00:00:00Z
now/y 2026-01-01T00:00:00Z
2024-03-01 2024-03-01T00:00:00Z
2024-03-01T12:00:00+08:00 2024-03-01T04:00:00Z
2024-03-01+M 2024-04-01T00:00:00Z
now[Asia/Shanghai]/d 2026-09-24T16:00:00ZAn expression is read from left to right. now-7d/d takes the current instant, goes back seven
days, and then rounds down to the start of that day.
Points in time
Every expression starts with a point in time, written in one of three forms.
The current instant
now is the moment your request arrives, to the millisecond. It is taken once per request, so
now means the same instant in from as in to. It is written in lower case.
A date
A date is written YYYY-MM-DD: four digits for the year and two each for the month and the day.
It stands for midnight UTC at the start of that day, or for the start of that day in the time
zone it names (see Time zones).
2024-03-01 2024-03-01T00:00:00Z
2024-02-29 2024-02-29T00:00:00ZA date and time
A date and time is written as in RFC 3339 on another website, the internet's profile of ISO 8601:
- The date, then
T, then the time of day asHH:MM:SS. The seconds are required. A lower-casetor a single space may stand in for theT. - Optionally, a fraction of a second: a
.and one to three digits..5is half a second, the same as.500. A millisecond is the finest a time can be written, because it is the finestnowhas. - Optionally, an offset from UTC:
Z(orz) for UTC itself, or+HH:MMor-HH:MM. Without an offset, the time of day is in UTC, or in the time zone the expression names.
2024-03-01T12:00:00 2024-03-01T12:00:00Z
2024-03-01 12:00:00 2024-03-01T12:00:00Z
2024-03-01T12:00:00Z 2024-03-01T12:00:00Z
2024-03-01T12:00:00+08:00 2024-03-01T04:00:00Z
2024-03-01T12:00:00-05:30 2024-03-01T17:30:00Z
2024-03-01T12:00:00.5Z 2024-03-01T12:00:00.500Z
2024-03-01T12:00:00.250+08:00 2024-03-01T04:00:00.250ZOnly real dates and times
A date or time that could be written but does not exist is rejected. February has no 30th, 2023 was not a leap year, the hours go up to 23, leap seconds are not counted, and an offset's hours go up to 23 as well. The years go from 0001 to 9999.
None of the following would be accepted:
2024-02-30
2023-02-29
2024-03-01T24:00:00
2024-12-31T23:59:60Z
2024-03-01T12:00:00+24:00
0000-12-31Date math
The point in time can be followed by any number of operations, applied one after the other from left to right:
+, a count and a unit add:+3dis three days later.-, a count and a unit subtract:-3dis three days earlier./and a unit round down to the start of that unit:/dis midnight at the start of the day. See Rounding.
The units are:
y: a yearM: a monthw: a weekd: a dayh: an hourm: a minutes: a secondms: a millisecond
Units are case-sensitive: M is a month and m is a minute. ms is a single unit, so
now+5ms is five milliseconds later.
The count is a whole number, written in digits. Without a count, it is 1: now-d is the same as
now-1d. Leading zeros change nothing, and the largest count is 9007199254740991. There are no
fractions. For a day and a half, write 36h.
An expression holds no spaces, apart from the one that may separate a date from its time of day.
now+90m 2026-09-25T16:07:12Z
now-30s 2026-09-25T14:36:42Z
now+5ms 2026-09-25T14:37:12.005Z
now-d 2026-09-24T14:37:12Z
now-007d 2026-09-18T14:37:12Z
now-36h 2026-09-24T02:37:12Z
now-2w 2026-09-11T14:37:12Z
now+y 2027-09-25T14:37:12ZMonths and years
Months and years move along the calendar. +M gives the same day of the following month, at the
same time of day. When that month is too short to have the day, the result is its last day, still
at the same time of day:
2024-01-15+M 2024-02-15T00:00:00Z
2024-01-31+M 2024-02-29T00:00:00Z
2024-01-31T15:30:00+M 2024-02-29T15:30:00Z
2024-03-31-M 2024-02-29T00:00:00Z
2024-02-29+y 2025-02-28T00:00:00ZEach operation moves along the calendar on its own. So one month and then another is not always the same as two months at once:
2024-01-31+M+M 2024-03-29T00:00:00Z
2024-01-31+2M 2024-03-31T00:00:00ZWeeks, days and smaller units
An hour is 60 minutes and a minute 60 seconds. As on most computer clocks, leap seconds are not counted, so a day in UTC is always 86,400 seconds, and a week seven such days. In a time zone that moves its clocks, a day can be 23 or 25 hours long, and days and weeks then move along the calendar as months do (see Daylight saving time).
2024-02-28+d 2024-02-29T00:00:00Z
2024-02-28+2d 2024-03-01T00:00:00Z
2024-12-31T23:00:00+2h 2025-01-01T01:00:00ZStaying within the calendar
Every step of an expression must stay within the years 0001 to 9999, not only its result. The day after the 31st of December 9999 and the day before the 1st of January 0001 are both rejected, and so is going back a day from 0001-01-01 and forward again: the first step has already left the calendar.
9999-12-31+d
0001-01-01-d
0001-01-01-d+dRounding
/ and a unit set the time to the start of the unit it lies in. Rounding always goes down, to
the start, and never to the nearest:
/y: midnight on the 1st of January/M: midnight on the 1st of the month/w: midnight on Monday/d: midnight/h,/mand/s: the start of the hour, the minute or the second/mschanges nothing, because no time is finer than a millisecond
That is on the clock of the time zone the expression names, and in UTC when it names none.
now/h 2026-09-25T14:00:00Z
now/w 2026-09-21T00:00:00Z
2026-09-27T23:59:59/w 2026-09-21T00:00:00Z
2026-09-28/w 2026-09-28T00:00:00Z
2024-03-01T12:00:00.750/s 2024-03-01T12:00:00Z
1969-12-31T12:00:00/d 1969-12-31T00:00:00ZThe last second of Sunday the 27th still belongs to the week that began on Monday the 21st, and Monday the 28th begins a new one.
Rounding combines with the other operations in any order. now/d+d is midnight at the end of
today, and now-d/d is midnight at the start of yesterday. A rounding takes no count, so now/2d
is rejected.
Time zones
An expression is evaluated in UTC unless it names a time zone. An offset only says how to read the time it is written on, and does not carry over to the operations after it. So without a zone, rounding to the day gives midnight UTC:
2024-03-01T02:00:00+08:00 2024-02-29T18:00:00Z
2024-03-01T02:00:00+08:00/d 2024-02-29T00:00:00ZAt 2 a.m. on the 1st of March in China, it is still the 29th of February in UTC, so that is the day the time rounds down to.
Naming a time zone
For days, weeks, months and years somewhere else, write a time zone in brackets right after the point in time, before any operation. Every operation after it then works on that zone's clock and calendar. The result is still one instant, and the website and the API show it in UTC. Here each result is shown twice: in UTC, and as the same instant on the zone's clock.
now[Asia/Shanghai] 2026-09-25T14:37:12Z 2026-09-25T22:37:12+08:00
now[Asia/Shanghai]/d 2026-09-24T16:00:00Z 2026-09-25T00:00:00+08:00
now[Asia/Shanghai]/d+d 2026-09-25T16:00:00Z 2026-09-26T00:00:00+08:00
now[Europe/Berlin]/d 2026-09-24T22:00:00Z 2026-09-25T00:00:00+02:00
now[Europe/Berlin]/w 2026-09-20T22:00:00Z 2026-09-21T00:00:00+02:00
now[Europe/Berlin]-M/M 2026-07-31T22:00:00Z 2026-08-01T00:00:00+02:00At now, it is 22:37 on Friday in China. Friday there began at midnight, which was 16:00 UTC on
Thursday, and it ends at the next midnight, 16:00 UTC on Friday. The zone doesn't move now
itself, only what follows it.
A time zone is one of two things:
- A name from the IANA time zone database, such as
Asia/Shanghai,Europe/Berlin,America/New_YorkorUTC, spelled exactly as there:europe/berlinis rejected. A named zone follows that place's rules, daylight saving time and historic changes included. - A fixed offset,
+HH:MMor-HH:MM, as[+08:00]. It never changes, so[+01:00]is Berlin only in winter. Use a name for a place, and a fixed offset only when a fixed offset is what you mean. Prefer[+08:00]to the database'sEtc/GMT-8, which names the same offset with its sign inverted.
A date or time in a time zone
A date or time written without an offset is read on the zone's clock. A date alone is the start of that day there.
2025-01-01[Asia/Shanghai] 2024-12-31T16:00:00Z 2025-01-01T00:00:00+08:00
2026-09-25T09:00:00[Europe/Berlin] 2026-09-25T07:00:00Z 2026-09-25T09:00:00+02:00An offset, Z included, still says which instant is meant, and the zone applies only to the
operations after it. So an instant copied in UTC can be rounded to a day somewhere else:
2026-09-25T20:00:00Z[Asia/Shanghai]/d 2026-09-25T16:00:00Z 2026-09-26T00:00:00+08:00
2026-09-25T20:00:00Z/d 2026-09-25T00:00:00ZDaylight saving time
In a zone that moves its clocks, y, M, w and d move along the calendar and keep the time
of day, so a day is 23 or 25 hours long where the clocks change. h, m, s and ms are exact.
Berlin moved to summer time on the 29th of March 2026, at 2 a.m.:
2026-03-28T12:00:00[Europe/Berlin]+d 2026-03-29T10:00:00Z 2026-03-29T12:00:00+02:00
2026-03-28T12:00:00[Europe/Berlin]+24h 2026-03-29T11:00:00Z 2026-03-29T13:00:00+02:00
2026-03-29T12:00:00[Europe/Berlin]/d 2026-03-28T23:00:00Z 2026-03-29T00:00:00+01:00
2026-03-29T12:00:00[Europe/Berlin]/d+d 2026-03-29T22:00:00Z 2026-03-30T00:00:00+02:00When the clocks go back, an hour happens twice. A time in it is the first time the clock reads it, unless an offset picks the second. Berlin moves back to winter time on the 25th of October 2026, from 3 a.m. to 2 a.m.:
2026-10-25T02:30:00[Europe/Berlin] 2026-10-25T00:30:00Z 2026-10-25T02:30:00+02:00
2026-10-25T02:30:00+01:00[Europe/Berlin] 2026-10-25T01:30:00Z 2026-10-25T02:30:00+01:00When the clocks go forward, an hour is skipped, and a time written in it is rejected, as
2024-02-30 is. Date math that lands in it is not an error, or now-d would fail on the day
after the clocks change. It moves on by the hour skipped:
2026-03-29T02:30:00[Europe/Berlin]2026-03-28T02:30:00[Europe/Berlin]+d 2026-03-29T01:30:00Z 2026-03-29T03:30:00+02:00When midnight is skipped
A few zones move their clocks at midnight.
The start of such a day is its first instant: Havana skipped from midnight to 1 a.m. on the 10th
of March 2024, so that day began at 1 a.m. The time 00:00:00 did not exist there that day:
2024-03-10[America/Havana] 2024-03-10T05:00:00Z 2024-03-10T01:00:00-04:00
2024-03-10T12:00:00[America/Havana]/d 2024-03-10T05:00:00Z 2024-03-10T01:00:00-04:002024-03-10T00:00:00[America/Havana]/d+d keeps the time of day at which the day began, so on such a day it lands at 1 a.m. the next
day. +d/d is the start of the next day on every day:
2024-03-10T12:00:00[America/Havana]/d+d 2024-03-11T05:00:00Z 2024-03-11T01:00:00-04:00
2024-03-10T12:00:00[America/Havana]+d/d 2024-03-11T04:00:00Z 2024-03-11T00:00:00-04:00A handful of days never happened at all, where a place moved across the date line. Samoa went from the 29th of December 2011 straight to the 31st, so its 30th is rejected:
2011-12-30[Pacific/Apia]Mistakes with time zones
None of the following is accepted. The zone belongs to the point in time, right after it, with no
space. A name is spelled exactly as in the database, and a fixed offset in full, with its colon
and within the limits of an offset. Z is not a zone: write [UTC] or [+00:00].
now/d[Europe/Berlin]
now [Europe/Berlin]
now[europe/berlin]
now[Berlin]
now[Z]
now[+8:00]
now[+24:00]Timeframes
A timeframe is two expressions: from, the first instant in it, and to, the first instant
after it. from is included and to is not. Both are evaluated with the same now.
This is why rounding always goes down. The end of today is the start of tomorrow, now/d+d, and
it takes no rounding up to write it.
now/d now/d+d today
now-d/d now/d yesterday
now/w now this week so far
now/w now/w+w this week, from Monday to Sunday
now-24h now the last 24 hours
now-7d/d now/d the last seven whole days
now/M now/M+M this month
now-M/M now/M last month
2024-03-01 2024-04-01 March 2024
2024-03-01 2024-03-01+M March 2024 againIn a time zone, name it in both ends:
now[Asia/Shanghai]/d now[Asia/Shanghai]+d/d today in China
now[Europe/Berlin]-d/d now[Europe/Berlin]/d yesterday in Berlin
now[Europe/Berlin]-M/M now[Europe/Berlin]/M last month in Berlin
2025-01-01[Asia/Shanghai] 2026-01-01[Asia/Shanghai] 2025 in Chinanow[Asia/Shanghai]+d/d rather than /d+d ends the day right in a zone whose days may not start
at midnight (see When midnight is skipped). The two
ends may name different zones, but a timeframe reads as it sounds only when they name the same.
A date in to is the first day outside the timeframe. To include the 31st of March, to is
2024-04-01, or 2024-03-31+d, and not 2024-03-31.
A timeframe whose from is not before its to would hold no instant at all, so it is rejected,
even when each of the two expressions is valid on its own. from now with to now/d is
rejected, because today began before now.
Whether you may leave out from or to, and what an end that is left out means, depends on
where the timeframe is used, and an end that is left out counts with that meaning here too. The
API reference says it for each operation.
Syntax errors
An expression is either valid as a whole or rejected as a whole. The following are typical syntax errors, every expression listed here being rejected:
Upper case where the language has lower case.
nowis written in lower case, and the units are case-sensitive: an hour ishand a day isd.NOW now+8H now+1DRejected Spaces around an operation. The second of these is what a
+becomes in a URL (see In a URL).now - 1d now 1dRejected An operation without its unit, a count on a rounding, and a count with a fraction. For a day and a half, write
now-36h.now+ now/2d now-1.5dRejected A date or time not written in full: the month and the day take two digits each, the seconds are required, a fraction has at most three digits, and an offset has its colon,
+08:00.2024-3-1 2024-03-01T12:00 2024-03-01T12:00:00.1234 2024-03-01T12:00:00+0800Rejected
In a URL
A + in a URL's query string is read as a space, so ?from=now+1d arrives as now 1d and is
rejected. Write + as %2B there: ?from=now%2B1d. Alternatively, write a T between a
date and its time of day rather than a space.
The brackets around a time zone are percent-encoded too, [ as %5B and ] as %5D, and so is
the + of a fixed offset: now[Europe/Berlin]-d/d is ?from=now%5BEurope/Berlin%5D-d/d, and
now[+08:00]/d is ?from=now%5B%2B08:00%5D/d. The / in a zone's name needs no encoding.
In a JSON request body, an expression is a string like any other and needs no escaping.