def pure parseTime(source: text): number
def pure parseTime(source: text, formats: text): number
def pure parseTime(source: text; format: text): number
Parses a time-of-day from source and returns it as a fraction of a day
between 0 and 1. If no format is specified, yyyy-MM-dd HH:mm:ss is assumed.
Date components are accepted but discarded; time zone offsets are applied when
the format includes z.
source: the text to parse.
formats: the time format to use.
Example
show summary "Time parsing" with
parseTime("2021-01-01 12:00:00") as "Parsed"
printTime(0.5, "HH:mm:ss") as "Printed"
This outputs the following summary:
Parsed
Printed
0.5
12:00:00
Errors
Invalid values report an error; use tryParseTime
to handle failures.