Search Postgresql Archives

Re: Age() calculation question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 10, 2005 at 18:32:39 -0700,
  Bob Lee <bob@xxxxxxxxxx> 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.

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux