time

Clocks and dates: the time now, timestamps, formatting, parsing and waiting.

import time

Example

import time

let ts = time.parse("2026-10-26 09:30", "%Y-%m-%d %H:%M")
say(time.format(ts, "%A %d %B %Y at %H:%M"))
say(time.format(ts + 3600, "%H:%M"))
let now = time.now()
say(type(now.year), type(time.timestamp()))

Functions

now()

returns map

The date and time right now: {"year", "month", "day", "hour", "minute", "second", "weekday", "month_name", "timestamp"}.

timestamp()

returns number

Seconds since 1 January 1970 (UTC), with fractions. Good for timing and storing.

sleep(seconds)

Wait for that many seconds (fractions are fine) before going on.

format(timestamp, pattern?)

returns text

A timestamp as readable text, in local time. The pattern uses %Y year, %m month, %d day, %H hour, %M minute, %S second, %A weekday, %B month name (default "%Y-%m-%d %H:%M:%S").

parse(text, pattern?)

returns number

Read a date/time written as text and give its timestamp. Without a pattern it reads forms like "2026-10-26" and "2026-10-26 14:30:00".

today()

returns text

Today's date, like "2026-10-26".

since(timestamp)

returns number

How many seconds have passed since that timestamp.