Age function

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Age function
Date: 2006-05-17 13:49:14
Message-ID: 446B29DA.6010203@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I believe I already mentioned something along these lines as an aside,
but this time I need it to work...

Look here:

template1=> select age(now() + '01:30:00'::interval);
age
------------------
-17:02:41.247957
(1 row)

So, One and a half hour in the future is actually 17 days ago?
Interesting... Either I am doing something wrong, or postgres is, I have
my suspicions ;)

Now, what I tried to achieve was a numeric representation for the
interval. As an interval of (for example) a month is kind of hard to
translate into a number (28, 29, 30 or 31 days?), I figured adding the
interval to now() and calculating the age of the result. I figured that
would nicely give me what I want... For the types of intervals I use
(hours and minutes) this could have worked, but... well, see above.

For the record, I tried this first on 7.4.7 (debian packages... shrug)
and then on 8.1.3. Both show this behaviour.

Regards,
--
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tino Wildenhain 2006-05-17 13:56:18 Re: GUI Interface
Previous Message Scott Venter 2006-05-17 13:31:13 Re: [Linux] Suitable 64bit