sqldremio

How to add hours in a TO_TIMESTAMP function?


New to SQL

I am using the TO_TIMESTAMP feature to change a column to datetime. Is there anyway I can apply a subtraction of 5 hours into the TO_TIMESTAMP function that would apply it everytime the SQL is ran?

How I am using it currently:

select col1
TO_TIMESTAMP(col2,'YYYY-MM-DD"T"HH24:MI:SS"Z"' ) as col2 from table

Solution

  • check this

    SELECT 
      TO_TIMESTAMP(col2,'YYYY-MM-DD"T"HH24:MI:SS"Z"' ) - INTERVAL '5' HOUR td
    FROM Table1