Skip to main content

Module time

Module time 

Source
Expand description

Timestamps as pi writes them: Unix milliseconds and ISO 8601 UTC with milliseconds, and ids.

Functions§

hex
bytes as lowercase hexadecimal.
iso
2026-10-02T14:49:48.573Z, as JavaScript’s Date.toISOString.
now_iso
The current time as iso.
now_ms
Unix time in milliseconds.
parse_iso
Parses iso output, and offsets other than Z, to Unix milliseconds.
random_bytes
N bytes from the OS generator; zeros on a platform without one.
random_hex
count random bytes as lowercase hexadecimal.
uuid_v4
A random UUID v4, as crypto.randomUUID.
uuid_v7
A time-ordered UUID v7, used for session ids.