Reputation: 1260
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?
Upvotes: 17
Views: 18347
Reputation: 8860
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.
Upvotes: 3
Reputation: 15856
select some_date at time zone 'Europe/Berlin' from some_table
Upvotes: 24