intervalValue()

The dateTimeLib.intervalValue() system function returns an INTERVAL value from a source string. EGL maintains this function for compatibility with earlier versions. New code can simply assign the string to the TIME variable.

The function expects an input string containing six digits. The first four digits represent the number of years in the interval, and the last two represent the number of months. If you want to specify a pattern other than "yyyyMM", use dateTimeLib.intervalValueWithPattern().

To convert the string value to an INTERVAL value, EGL uses the following methods in order:
  1. EGL attempts to parse the text into an INTERVAL value using the "yyyyMM" mask. If EGL cannot parse the text in this way, it tries the next method.
  2. EGL parses the text into two groups of digits: four for the year and two for the month, using non-digit characters as separators between the digits:
    1. EGL first ignores any non-digit characters at the beginning of the text.
    2. EGL then uses the following digit characters for the years field of the INTERVAL value. EGL stops adding digits to this field when it reaches a non-digit character in the text or when it reaches four digits.
    3. EGL skips any following non-digit characters.
    4. EGL then repeats Steps b and c for the two digits each in the month field.
    5. After all the fields have been filled, any remaining digit or non-digit characters in the text are ignored.
    If this process does not produce at least one digit for each field in the pattern, the process fails and throws a TypeCastException.

    For examples of this parsing process, see dateValue().

Syntax

  dateTimeLib.intervalValue(intervalAsString STRING? in)
  returns (result INTERVAL?)
intervalAsString
A string that contains six digits whose meaning is interpreted by the interval pattern "yyyyMM".
result
An INTERVAL variable. If intervalAsString is null, the function returns a null value.

Compatibility

Table 1. Compatibility considerations for intervalValue
Platform Issue
Rich UI INTERVAL values are not supported.

Feedback