Curious age() behavior

From: "Mitch Vincent" <mitch(at)venux(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Curious age() behavior
Date: 2000-10-10 18:28:42
Message-ID: 016401c032e7$eb0fcf90$0200000a@doot
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Maybe I'm just overlooking something really simple but this has me a bit
confused.

What I'm trying to do is get the amount of time from A to B -- I thought
age() would do just that but it seems to be about a day off sometimes.

hhs=# SELECT age('Sun Dec 03 08:00:00 2000 EST','Tue Oct 10 08:00:00 2000
EDT') as esec;
esec
------------------------
@ 1 mon 24 days 1 hour
(1 row)

Ok, but if I turn right around and add that value back , I get :

hhs=# SELECT ('Tue Oct 10 08:00:00 2000 EDT'::timestamp + '1 mon 24 days 1
hour'::interval);
?column?
------------------------------
Mon Dec 04 08:00:00 2000 EST
(1 row)

Like I said, perhaps I'm blind and can't see what's happening here but
shouldn't that be Sunday the 3rd of December?

Thanks!

-Mitch

Browse pgsql-general by date

  From Date Subject
Next Message Mitch Vincent 2000-10-10 18:32:30 Curious age() behavior Cont'd
Previous Message Marc SCHAEFER 2000-10-10 18:09:55 Re: Some advanced database features, are they present in PostgreSQL