Search Postgresql Archives

Age function

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

 



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@xxxxxxxxxxxxxxxxx

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 //


[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