extend()
The dateTimeLib.extend() system function
converts a TIMESTAMP, TIME, or DATE value into a longer or shorter
TIMESTAMP value. The following examples show this process:
- If you have an input timestamp defined as "ddHH" (day and hour) and provide a timestamp pattern of "ddHHmm" (day, hour, and minute), dateTimeLib.extend() returns an extended value that matches the pattern.
- If you have an input timestamp defined as "yyyyMMddHHmmss" (year, month, day, hour, minute, and second) and provide a timestamp pattern "yyyy" (year), dateTimeLib.extend() returns a shortened value that matches the pattern
Syntax
dateTimeLib.extend(
extensionField DATE? | TIME? | TIMESTAMP? in
[, pattern outputTimeStampPattern? in ])
returns (result TIMESTAMP?)
- extensionField
The name of a TIMESTAMP, TIME, or DATE variable. The variable contains the value to be extended or shortened.
- pattern
- A string literal or constant that defines the pattern of the timestamp
value returned by the function. For more information, see Date/time masks and format specifiers. If pattern is
a null value or omitted, the function uses one of the following default
formats:
- If extensionField is a DATE or TIME, the default format is "yyyyMMddHHmmss".
- If extensionField is a TIMESTAMP, the default format is "yyyyMMddHHmmssffffff".
- result
A TIMESTAMP variable. If extensionField is null, the function returns a null value.