'How to alter column in varchar datatype to timestamp? The data in the column are in the format 'yyyy-mm-ddThh:mm:ss

Given the below sample data, what will be the alter column clause in Redshift to change it to timestamp? currently it is in varchar

timestamp
2021-11-23T13:39:54+00:00
2021-11-23T14:16:25+00:00


Solution 1:[1]

Try this:

cast(column_name as timestamp)

You can read about it here:

https://devdocs.io/postgresql~9.4/sql-expressions#SQL-SYNTAX-TYPE-CASTS

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 kunsterD93