Re: How to reformat output of "age()" function

From: "Basques, Bob (CI-StPaul)" <bob(dot)basques(at)ci(dot)stpaul(dot)mn(dot)us>
To: David Gauthier <davegauthierpg(at)gmail(dot)com>
Cc: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to reformat output of "age()" function
Date: 2019-09-11 16:12:21
Message-ID: 1402ED33-C80E-43E0-AB2A-D29326CAD3A7@ci.stpaul.mn.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

SELECT EXTRACT(EPOCH FROM age('2019-09-11 09:00:00','2019-09-09 11:00:00')::INTERVAL)/60;

A nice explanation and even a slick function are here:

https://stackoverflow.com/questions/3460805/postgresql-format-interval-as-minutes

bobb

On Sep 11, 2019, at 10:38 AM, David Gauthier <davegauthierpg(at)gmail(dot)com<mailto:davegauthierpg(at)gmail(dot)com>> wrote:

How can I change the default output of the "age" function to be, for example, in minutes?

E.g.
dvdb=> select age('2019-09-11 09:00:00','2019-09-09 11:00:00');
age
----------------
1 day 22:00:00
(1 row)

I want the equivalent of that time delta in minutes.

Thanks in Advance

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2019-09-11 16:34:04 Re: How to reformat output of "age()" function
Previous Message Ron 2019-09-11 15:46:05 Re: How to reformat output of "age()" function