我是靠谱客的博主 顺利香氛,这篇文章主要介绍PostgreSQL 数据库中时间字段如何减去 8 小时,现在分享给大家,希望可以做个参考。

PostgreSQL 数据库中时间字段如何减去 8 小时?

直接放一个测试执行的过程,方便大家使用:

postgres=# create table tt(id int, ttime timestamp without time zone);
CREATE TABLE
postgres=# insert into tt(ttime) select now();
INSERT 0 1
postgres=# select * from tt;
 id |           ttime
----+---------------------------
    | 2023-02-17 10:07:05.74534
(1 row)

postgres=# update tt set ttime = ttime - interval '8 hour';
UPDATE 1
postgres=# select * from tt;
 id |           ttime
----+---------------------------
    | 2023-02-17 02:07:05.74534
(1 row)

End~

最后

以上就是顺利香氛最近收集整理的关于PostgreSQL 数据库中时间字段如何减去 8 小时的全部内容,更多相关PostgreSQL内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(127)

评论列表共有 0 条评论

立即
投稿
返回
顶部