TIMESTAMP

Description

The TIMESTAMP function is a system function that casts a string value into a timestamp.

This function is fully supported in Snowflake.

Grammar Syntax

select "timestamp"(VARCHAR);

Sample Source Patterns

Input Code:

IN -> Redshift_01.sql
select "timestamp"('2024-03-01 3:22:33');

Output Code:

OUT -> Redshift_01.sql
select
TO_TIMESTAMP('2024-03-01 3:22:33');

Know Issues

In Amazon Redshift, the default precision for timestamps is 6 digits (microseconds), while in Snowflake, the default precision is 9 digits (nanoseconds). Due to these differences in precision, itโ€™s important to consider your specific needs when working with timestamps. If you require different precision in either platform, you can use the following options.

  1. Use ALTER SESSION:

    --This example is for 2 digits for precision (FF2).
    ALTER SESSION SET TIMESTAMP_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF2';

Please note that depending on the data type used to store the value obtained with GETDATE(), there may be limitations in precision that could result in a loss of accuracy.

There are no known issues.

Last updated