下面的查询
SELECT the_date FROM date_trunc('day', timestamp with time zone
'2001-01-1 00:00:00+0100') as the_date
结果
the_date
2000-12-31 00:00
有没有办法告诉date_trunc根据输入的时区进行日/月/年转换?
预计yields 为:2001-01-1 00:00+0100
下面的查询
SELECT the_date FROM date_trunc('day', timestamp with time zone
'2001-01-1 00:00:00+0100') as the_date
结果
the_date
2000-12-31 00:00
有没有办法告诉date_trunc根据输入的时区进行日/月/年转换?
预计yields 为:2001-01-1 00:00+0100
您需要指定要在哪个时区显示
select
date_trunc(
'day',
timestamp with time zone '2001-01-1 00:00:00+0100' at time zone '-02'
) as the_date;
the_date
---------------------
2001-01-01 00:00:00