Reference · Dates

now

signature
now() -> int

What it does

The time now as milliseconds since 1970-01-01T00:00:00Z, an int: the clock for measuring how long something took, for timestamps stored as numbers and for max_age-style arithmetic. date.from_ms turns it into a date-time and date.ms a date-time into it. It is the time effect. For today's date or the time as text, see date.today and date.now.

Examples

let t = now()print(type_of(t), len(str(t)), t > 1700000000000)print(date.from_ms(t) | date.valid("date-time"))
output
int 13 truetrue

Edge cases

let a = now()sleep(5)let b = now()print(b >= a + 5)let day = 24 * 60 * 60 * 1000print((date.from_ms(now() + day) | date.date_in) == date.add_days(date.today(), 1))
output
truetrue

Errors

It takes no arguments and cannot fail; there is nothing to check.

print(now() - now() <= 0)
output
true

Chaining

print(now() | date.from_ms("Europe/Lisbon") | date.valid("date-time"))print(now() | date.from_ms | date.date_in | len)
output
true10

See also

date.now, date.today, date.from_ms, date.ms, sleep

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

Thread 0 posts

On 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