Re: Age() calculation question

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Bob Lee <bob(at)cnsisp(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Age() calculation question
Date: 2005-05-11 05:26:55
Message-ID: 20050511052655.GA4810@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 10, 2005 at 18:32:39 -0700,
Bob Lee <bob(at)cnsisp(dot)com> wrote:
> I have two timestamps -- start and end. I use age(end,start)
> to give me a "session" time and then I subtotal those. If
> the total times are less than 24 hours I get a time is the
> format of XX:xx:xx -- this is great. But if the time is over
> 24 hours I get 1 day XX:xx:xx, which really raises hell with
> my export to Excel. Any suggestions on how to avoid this
> little snag?

You want to do something like:
extract(epoch from (end - start))

That will give you the elapsed time in seconds. You don't want to use
'age' as that will do not nice things if the interval is over 1 month.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vikas 2005-05-11 05:27:28 Re: database export in pgsql
Previous Message Tom Lane 2005-05-11 05:07:13 Re: [GENERAL] SECURITY RELEASES: 7.2.8 - 7.3.10 - 7.4.8 - 8.0.3