Re: format return of "age" to hh:mm

From: Andrei Zhidenkov <andrei(dot)zhidenkov(at)n26(dot)com>
To: Ray O'Donnell <ray(at)rodonnell(dot)ie>
Cc: David Gauthier <davegauthierpg(at)gmail(dot)com>, Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: format return of "age" to hh:mm
Date: 2020-03-05 16:12:16
Message-ID: B8FA4081-EB2C-4017-B36B-3B2B6F326CDC@n26.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

However, you cannot use to_char() to display the count of days for a given interval. In this case, if your interval is larger than 24 hours, you might use extract(epoch from <interval>) and perform the conversion manually.

> On 5. Mar 2020, at 17:07, Ray O'Donnell <ray(at)rodonnell(dot)ie> wrote:
>
> On 05/03/2020 15:50, David Gauthier wrote:
>> Hi:
>>
>> How does one reformat the output of the "age" function to always be in
>> terms of hours:mins.
>
> Hi there,
>
> age() returns an interval, so without having tried it I'm guessing you
> could use to_char() to format it whatever way you want.
>
> Ray.
>
> --
> Raymond O'Donnell // Galway // Ireland
> ray(at)rodonnell(dot)ie
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-03-05 16:19:31 Re: format return of "age" to hh:mm
Previous Message Ray O'Donnell 2020-03-05 16:07:57 Re: format return of "age" to hh:mm