Reference · Dates

date.now

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

What it does

The date and time now, to the second, as RFC 3339 text: "2026-10-27T14:30:00Z" in UTC. With a time zone (an IANA name, "UTC", or an offset like "+05:30" or "+0530"; see date.valid_zone) it is the same instant written at that zone's offset, "2026-10-27T15:30:00+01:00". It reads the clock, so it is the time effect, and a script run with run_script does without it. For milliseconds as an int, use now.

Examples

let t = date.now()print(len(t), type_of(t), date.valid(t, "date-time"))print(ends_with(t, "Z"), date.date_in(t) == date.today())
output
20 str truetrue true

Edge cases

let paris = date.now("Europe/Paris")print(len(paris), ends_with(paris, "+01:00") || ends_with(paris, "+02:00"))print(date.now("+05:30") | ends_with("+05:30"), date.now(null) | ends_with("Z"))print(date.ms(date.now()) <= now())
output
25 truetrue truetrue

Errors

A zone that is not a string, or one the time zone database does not know, is a runtime error, not an error value.

this one fails
print(date.now("Europe/Nowhere"))
output
line 1: `date.now`: unknown time zone "Europe/Nowhere"

Chaining

print(date.now() | date.date_in("Asia/Tokyo") | date.valid("date"))print(date.now() | date.to_zone("America/New_York") | date.parts | keys)
output
true["year", "month", "day", "weekday", "hour", "minute", "second", "offset"]

See also

date.today, now, date.to_zone, date.date_in, date.ms, date.format

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

Thread 0 posts

On date.now(): 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