tsrange
当只有一个时间间隔处于夏时制且时间间隔少于1小时时,我在PostgreSQL中保存类型的值时遇到问题。
例如,我想保存45分钟的长时间范围["2013-03-09 01:30:00","2013-03-09 01:15:00"]
,但是我得到了error range lower bound must be less than or equal to range upper bound
有没有一种方法可以使用tsrange
type将这些时间范围保存到PostgreSQL中?
输入必须已经“时区”,然后强制转换为 timestamp without time zone
select tsrange(
('2013-02-17 01:30:00'::timestamp at time zone 'BRST')::timestamp,
('2013-02-17 01:15:00'::timestamp at time zone 'BRT')::timestamp
);
tsrange
-----------------------------------------------
["2013-02-17 00:30:00","2013-02-17 01:15:00")
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句