1

I am trying to convert a numeric to timestamp in postgresql. However, it always converts it in EST timezone. Before running the query, I try the following.

set time zone 'UTC+10';

select to_timestamp(r.date/1000) as current_email_timestamp
FROM email;

However, It the timestamp always seem to be in US timezone. The emails are mostly sent during working hours but when I change the numeric back to timestamp with above query, it shows all the emails at night time

Could it be that the timestamp in numeric was stored in US timezone, or could it be that when converting back from numeric to timestamp, it is not coverting the timezone correctly.

Can someone please tell me how to fix this

Regards Arif

1
  • Can you show us what the input numerics look like? Commented Oct 22, 2014 at 18:21

1 Answer 1

2

You can use the at time zone modifier:

select to_timestamp(1411738200), 
       to_timestamp(1411738200) at time zone 'America/Chicago', 
       to_timestamp(1411738200) at time zone 'UTC+10'

Your postgres installation probably defaults to EST.

Sign up to request clarification or add additional context in comments.

Comments

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.