PG的时间函数使用整理如下
https://blog.csdn.net/dahuzix/article/details/48576945
1.获取系统时间函数
-- :: -- :: -- ::
2.时间的计算
–使用interval
day’; –-- :: 2天后 day’; –-- :: 2天前 hour’; –-- :: 2小时后
….
interval可以不写,其值可以是
Abbreviation Meaning Y Years M Months (in the date part) W Weeks D Days H Hours M Minutes (in the time part)
3.时间的截取
–使用extract extract(interval,timestamp); 5月份 …
interval值参考上面
4.时间的转换
-- ::’; –-- :: -- ::’; –-- -- ::’; –:: -- ::’ –-- ::+
–与unix时间戳的转换
SELECT TIMESTAMP ‘epoch’ + * INTERVAL ‘ second’; –-- ::
以上是基本的PG函数使用,可满足一般的开发运维应用