17

I want to retrieve the daily number of signups recorded in Berlin timezone, but by default my database is using timezone '-08'. How do I do a select statement while specifying timezone?

2 Answers 2

25
select some_date at time zone 'Europe/Berlin' from some_table
Sign up to request clarification or add additional context in comments.

Comments

4

So are you looking for timezone the client was in when they registered? If you don't record it it's gone. timestamptz or timestamp with timezone converts from local timezone to GMT on the way in, and GMT to local on the way out. It does not store the current timezone. It simply adjusts inputs and outputs to it. If you need to store the timezone you need to store it in another column when you create or update the row.

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.