PGSQL中的时间函数

1.首先系统默认的四个函数,前两个是日期+时间,后面的是单独日期函数与单独时间。
--标准时间函数
select now();
2022-01-04 10:31:26.435501+08
--标准时间函数,同now()
select current_timestamp;
2022-01-04 10:31:33.679012+08
--标准日期
select current_date;
2022-01-04
--标准时间
select current_time;
10:31:47.180718+08
2.时间上的计算。这里是可以根据当前时间计算下个月,下周的时间等等,个人喜欢用current_date(纯日期,看着舒服),计算时间加减,注意关键字interval(间隔的意思),但是用now时可以不加!!!
--当前日期 + 一天
select current_date,current_date + interval '1 day';
2022-01-04 2022-01-05 00:00:00
--当前日期 + 一周
select cur

PGSQL中的时间函数最先出现在Python成神之路

版权声明:
作者:congcong
链接:https://www.techfm.club/p/12489.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>