开发者

How to select date with timezone in Postgresql?

I wa开发者_如何学编程nt 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?


select some_date at time zone 'Europe/Berlin' from some_table


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜