6

I have a timestamp field in my table that has stored the data in UTC-10. However, the correct timezone is UTC+10

I would like to change the timezone part to UTC+10 without shifting the hours. Only want the system to consider the same timestamp as UTC+10 instead of UTC-10

If I do it like

select email_timestamp as time zone 'UTC+10' from emails

then it also shift the hours.

Can someone please tell me how to change the timezone part without shifting the hours?

2
  • 1
    "I have a timestamp field in my table that has stored the data in UTC-10." PostgreSQL doesn't store timestamps that way. If you declared the column to be of type timestamp with time zone, "the internally stored value is always in UTC". Commented Oct 27, 2014 at 23:36
  • 1
    Please, provide: CREATE TABLE for your table (timestamp column in particular), sample data found in the table and the result that you'd like to achieve. Commented Oct 28, 2014 at 7:04

1 Answer 1

5

Strip off the time zone without changing the time, then add a timezone without converting the time:

(myfield::timestamp || 'UTC+10')::timestamptz

Select it again for your timezone to see that's what you wanted:

SELECT myfield AT TIME ZONE 'UTC+10'
Sign up to request clarification or add additional context in comments.

1 Comment

"ERROR: invalid input syntax . . ."

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.