我想计算两个日期之间的几个月.
原文链接:https://www.f2er.com/postgresql/192545.html做:
SELECT TIMESTAMP '2012-06-13 10:38:40' - TIMESTAMP '2011-04-30 14:38:40';
退货:
0年0个月409天20小时0分0.00秒
所以:
SELECT extract(month from TIMESTAMP '2012-06-13 10:38:40' - TIMESTAMP '2011-04-30 14:38:40');
返回0.