PostgreSQL: format interval as minutes

后端 未结 3 1091
时光取名叫无心
时光取名叫无心 2020-12-29 19:31

When I subtract timestamps, the interval is in form DD:HH:MM:SS. How can I convert it all to minutes without extracting days and hours and multiplication/addition

3条回答
  •  孤城傲影
    2020-12-29 20:04

    SELECT EXTRACT(EPOCH FROM '2 months 3 days 12 hours 65 minutes'::INTERVAL)/60;
    

    seems to work.

    WARNING: "seems" is the key word.

提交回复
热议问题