Capy-Bearer Documentation

time_parse

lib call

Capy

function time_parse(value : string) u64

Description

time_parse converts date or time text to a Unix timestamp. It accepts YYYY-MM-DD HH:MM:SS, the same with a T between date and time, an optional trailing Z, UTC, or +00:00, YYYY-MM-DD HH:MM, a bare YYYY-MM-DD (midnight), and a plain number of seconds. All text is read as UTC. Any other text, an impossible calendar date, or an instant before 1970 gives zero.

Parameters

value : date or time text

Return Values

parsed Unix timestamp, or zero when parsing fails

Example

Capy

print(time_parse("1970-01-01 00:00:05 UTC"), "\n")

Output

5