I am facing an issue when using the function to_timestamp() on Aginity Workbench for AWS Redshift. For some reason I don't understand, 2 hours are added to the timestamp i am trying to create.
I have been looking for a solution but couldn't find anything similar, can someone help me solving this problem ?
The following code :
select
'2017-10-17 10:30:00' test,
to_timestamp('2017-10-17 10:30:00','YYYY-MM-DD HH24:MI:SS') test_converted
Retrieves :
test = 2017-10-17 10:30:00
test_converted = 2017-10-17 12:30:00
you can use :: to cast types in postgres and redshift, so your code would be
select '2017-10-17 10:30:00'::timestamp;
this would resolve your issue.
(I think your previous code was converting to local timezone)