Define maximum time increment. - Mailing list pgsql-general

From Joshua Moore-Oliva
Subject Define maximum time increment.
Date
Msg-id 200303080111.14034.josh@chatgris.com
Whole thread Raw
List pgsql-general
I am attempting to extract the number of months, or sometimes minutes from an
interwith with age for example.

SELECT age(timestamp '1957-06-13 10:57');

returns "45 years 8 mons 24 days 13:03"

while

SELECT EXTRACT (minutes FROM age(timestamp '1957-06-13 10:57') );

returns just "3"

Is there a way to define per session the MAXIMUM time increment for an
interval?  So that It would return the total number of minutes since that
date?


Basically, I think should could be achieved by some sort of interval
formatting functions...  something along the lines of

SELECT EXTRACT (minutes FROM ( age(timestamp '1957-06-13 10:57') LIMIT minutes
) );

I really need this functionality for a number of examples just no the minutes.
I know i could extract epoch, divide by 60 and I'm fine.  But I also needs
months...  then I need to extracts months plus years * 12..   I also have a
need for days...  then that gets even messier...


Any hints or even vague ideas are very welcome!

Josh.

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unexpected parse behaviour for date to timestamp
Next
From: Keiko Kondo
Date:
Subject: Re: My contract has been renewed