Reference · Dates
date.today
date.today(str | null=) -> strWhat it does
The calendar date now, as ISO text "YYYY-MM-DD", in UTC. With a time zone (an IANA
name like "Europe/Paris", "UTC", or an offset like "+05:30" or "+0530") it is the
date in
that zone, which can be a day before or after UTC's. It reads the clock, so it is the
time effect; a script run with run_script has the rest of date but not this.
Examples
let t = date.today()print(len(t), type_of(t), date.valid(t, "date"))print(t >= "2026-01-01", date.today("Europe/Paris") | date.valid)10 str truetrue trueEdge cases
- The zone decides the day: at the same instant
"+14:00"is never behind"-12:00", and can be two days ahead. nullas the zone is UTC, the same as leaving it out.- The text sorts in time order, so it compares with other dates as a string.
- It is UTC's date, not the visitor's: the server does not know a visitor's time zone. A page tells it with a cookie, see the user guide's Dates section.
print(date.today("+14:00") >= date.today("-12:00"))print(date.today(null) == date.today(), date.today("UTC") == date.today())print(date.today() > "1999-12-31")truetrue truetrueErrors
A zone that is not a string, or a name the time zone database does not know, is a runtime error, not an error value.
print(date.today("Mars/Olympus"))line 1: `date.today`: unknown time zone "Mars/Olympus"Chaining
The date comes first in a pipeline, so the arithmetic and formatting functions take it as their first argument:
print(date.today() | date.add_days(30) | date.valid("date"))print(date.today() | date.format("YYYY") | len)true4See also
date.now, now, date.add_days, date.format, date.date_in
Thread 0 posts
On date.today(): questions, tips, corrections, and code that uses it.
No posts yet. The first one opens the thread.
Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo