假设我有这个表结构:
Table "test"
Column | Type | Modifiers
----------------+-----------------------------+-----------
uuid | uuid | not null
created | timestamp without time zone | not null
Run Code Online (Sandbox Code Playgroud)
如何选择某个日期后的记录?但还要考虑特定时区?
由于created是没有区域的时间戳,我们可以假设它是UTC
示例查询:
select uuid from test where created >= '2017-07-20'
这将返回发生在或之后的所有事件2017-07-20 00:00:00.000 UTC我将如何查询发生在说之后的事件2017-07-20 00:00:00.000 GMT+2?无需在我的论点中增加数小时created > arg
select uuid
from test
where created > '2017-07-20'::timestamp with time zone at time zone '+02';
Run Code Online (Sandbox Code Playgroud)