Unix Technical Forum

Age() calculation question

This is a discussion on Age() calculation question within the Pgsql General forums, part of the PostgreSQL category; --> I have two timestamps -- start and end. I use age(end,start) to give me a "session" time and then ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 08:58 PM
Bob Lee
 
Posts: n/a
Default Age() calculation question

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?

Thanks for your help.

Bob Lee
--
**** I prefer email in plain text ****
bob@cnsisp.com blee@freeshell.org
pgp3EE2269 <certserver.pgp.com>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (NetBSD)

iD8DBQFCgWC2X1c+K9PuImkRAi4HAJ0cdTjPiNiAw/8BF53vCk1khaLDRACdEOf1
tVSM03lTNvHmguvAlj31UG8=
=Pm7K
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 08:58 PM
Bruno Wolff III
 
Posts: n/a
Default Re: Age() calculation question

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

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:28 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com