TO_TIMESTAMP function - Amazon Redshift

TO_TIMESTAMP function

TO_TIMESTAMP converts a TIMESTAMP string to TIMESTAMPTZ.

Syntax

to_timestamp ('timestamp', 'format')

Arguments

timestamp

A string that represents a timestamp value in the format specified by format.

format

The format for the timestamp value. Formats that include a time zone (TZ, tz, or OF) are not supported as input. For valid timestamp formats, see Datetime format strings.

Return type

TIMESTAMPTZ

Examples

The following example demonstrates using the TO_TIMESTAMP function to convert a TIMESTAMP string to a TIMESTAMPTZ.

select sysdate, to_timestamp (sysdate, 'HH24:MI:SS') as seconds; timestamp |seconds -------------------|---------------------- 2018-05-17 23:54:51|0001-03-24 18:05:17.0