From: | Joshua Moore-Oliva <josh(at)chatgris(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Define maximum time increment. |
Date: | 2003-03-08 06:11:13 |
Message-ID: | 200303080111.14034.josh@chatgris.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Keiko Kondo | 2003-03-08 07:08:55 | Re: My contract has been renewed |
Previous Message | Tom Lane | 2003-03-08 04:48:50 | Re: Unexpected parse behaviour for date to timestamp |