I have a text field "presence_changed_at" with text values i.e. '2014/12/17 08:05:28 +0000
. I need to convert this into timestamp. In postgreSQL there is function TO_TIMESTAMP(), however in redshift this does not seem to be supported. I can get the date without time by
TO_DATE("presence_changed_at",'YYYY/MM/DD HH24:MI:SS')
which produces
2014-12-12
but i can't find any way to get TIMESTAMP format.
Thanks in advance for solving this
Below functions worked for me correctly... Use whichever is applicable for you...
cast(column_name as timestamp)
to_date(column_name,'MM/DD/YYYY HH24:MI:SS')
to_date(column_name,'MM/DD/YYYY HH12:MI:SS')
to_timestamp(column_name,'MM/DD/YYYY HH24:MI:SS')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With