Reference · Dates

date.today

signature
date.today(str | null=) -> str

What 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)
output
10 str truetrue true

Edge cases

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")
output
truetrue truetrue

Errors

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.

this one fails
print(date.today("Mars/Olympus"))
output
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)
output
true4

See also

date.now, now, date.add_days, date.format, date.date_in

Thread
8Useful? Like it, or add to its thread below.

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