[英]PostgreSQL: How do I join two tables based on same start and end time (timestamp without time zone)?
[英]How do I specify “the start of today” in a specific time zone?
我有一个带有“带时区的时间戳”列的表。 我想找到时间戳早于今天的所有行,其中“今天”是在特定时区确定的。
我知道如何at time zone
使用将文字时间戳解释为在某个特定时区,并且我知道如何使用date_trunc
来获取当天的开头。 但我不确定如何将它们结合起来以获得我需要的东西。 我试过了
select date_trunc('day', current_date at time zone 'cst');
这给了我“2015-03-16 00:00:00”,但是我不清楚这个结果使用了什么时区(或者是否有一个时区)。 如何根据特定时区选择当天的开头?
它帮助我重新构建了如下问题:中心时区的当前日期和时间是多少? 然后,我想要的是那天开始的午夜[在中央时区]。 我发现我可以写这个
current_date::timestamp AT TIME ZONE 'cst'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.