util.Interval.parse
Converts a string to a DATETIME
value based on a
specified format.
Syntax
util.Interval.parse(
s STRING,
format STRING
)
RETURNS DATETIME q1 TO q2
- s is the source string to be parsed.
- format is the format specification (see Formatting INTERVAL values).
Usage
The util.Interval.parse()
method parses a string based on a format
specification, to produce an INTERVAL
value.
The format specification must be a combination of place holders such as
%Y
, %m
, %d
, etc.
The precision of the resulting INTERVAL
value depends on the format
specification. For example, when using "%Y-%m"
, the resulting value
will be an INTERVAL YEAR TO MONTH
.
The method returns NULL
, if the source string cannot be converted to
an INTERVAL
value based on the format specification.
For more details about the supported formats, see Formatting INTERVAL values.
Example
IMPORT util
MAIN
DEFINE iv INTERVAL DAY(6) TO FRACTION(5)
LET iv = util.Interval.parse( "-37467 + 23:45:34.12345", "%d + %H:%M:%S%F5" )
END MAIN