Builtin

str_time

str_time{s:str, t:time, format:str, default:float}

A relation generator. Can convert string s into time t and vice-versa.

For each string that cannot be parsed, no tuple is returned.

If format is given it is treated as a format string. See print for details.

If default is given it is used for t when s is "".

Examples

string to time
str_time(s:="2026-07-04T21:15:00Z")
tformatdefault
2026-07-04T21:15:00Z0001-01-01T00:00:00Z

time to string
str_time(t:=@2026-07-04T21:15:00Z)
sformatdefault
2026-07-04T21:15:00Z0001-01-01T00:00:00Z

time to string with format
str_time(t:=@2026-07-04T21:15:00Z, format:=":02/01/2006 15:04t")..s
04/07/2026 21:15