tryCastTimestamp
This procedure attempts to cast a string value to a timestamp and returns NULL
instead of an error when this is not possible. If the original value is NULL
, the returned value will also be NULL
.
Parameters
Parameter | Description |
---|---|
originalValue | Original value as a string |
format | Format of the date and time as a string |
checkFormatRegex | Regex format of the date and time as a string |
Attributes
Attribute | Type | Description |
---|---|---|
| timestamp | Value cast to the new type |
Example
CALL UTILS.tryCastTimestamp(
originalValue => '2018-10-21 10:05:02.987',
format => 'yyyy-MM-dd hh:mm:ss.SSS'
);;
Auto-parsing is available for the timestamp string:
yyyy-MM-dd
yyyy-MM-dd HH:mm:ss
yyyy-MM-dd HH:mm:ss.S
yyyy-MM-ddTHH:mm:ss
yyyy-MM-ddTHH:mm:ss.S