Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026.
We will start enforcing it in phases. For more information on the details of Python end of life
and migration options, see the
blog post
TIMESTAMP_CMP_TIMESTAMPTZ function
TIMESTAMP_CMP_TIMESTAMPTZ compares the value of a timestamp expression with a timestamp
with time zone expression. If the timestamp and timestamp with time zone values are
identical, the function returns 0. If the timestamp is greater
chronologically, the function returns 1. If the timestamp with time zone is
greater, the function returns –1.
Syntax
TIMESTAMP_CMP_TIMESTAMPTZ(timestamp, timestamptz)
Arguments
- timestamp
-
A column of data type
TIMESTAMPor an expression that implicitly evaluates to aTIMESTAMPtype. - timestamptz
-
A column of data type
TIMESTAMPTZor an expression that implicitly evaluates to aTIMESTAMPTZtype.
Return type
INTEGER
Examples
The following example compares timestamps to timestamps with time zones and shows the results of the comparison.
SELECT TIMESTAMP_CMP_TIMESTAMPTZ('2008-01-24 06:43:29', '2008-01-24 06:43:29+00'), TIMESTAMP_CMP_TIMESTAMPTZ('2008-01-24 06:43:29', '2008-02-18 02:36:48+00'), TIMESTAMP_CMP_TIMESTAMPTZ('2008-02-18 02:36:48', '2008-01-24 06:43:29+00');timestamp_cmp_timestamptz | timestamp_cmp_timestamptz | timestamp_cmp_timestamptz ---------------------------+---------------------------+-------------------------- 0 | -1 | 1