Skip to main content
Skip table of contents

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

ParameterDescription
originalValueOriginal value as a string
formatFormat of the date and time as a string
checkFormatRegexRegex format of the date and time as a string

Attributes

 Attribute

Type

Description

newValue

timestamp

 Value cast to the new type

Example

SQL
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

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.