RustyShackleford
RustyShackleford

Reputation: 3667

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

Upvotes: 0

Views: 450

Answers (1)

Derviş Kayımbaşıoğlu
Derviş Kayımbaşıoğlu

Reputation: 30565

check this

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

Upvotes: 1

Related Questions