Maximilian Tyrtania schrieb:
> Am 25.11.2007 8:43 Uhr schrieb "Andreas" unter <maps.on@gmx.net>:
>
>> I have a column with timestamps --> some_ts .
>> I'd like to calculate the amount of time between this timestamp and NOW().
>>
>> select some_ts - NOW() from some_table;
>>
>> This results in a column of type interval.
>>
>> How would I get this interval converted into e.g. minutes.
>> I need the whole value converted not just the 0-59 minutes part.
>> Like a difference of exactly 1 day = 24*60 minutes rather than 0
>> minutes if I just take the minute-part.
>>
>> Seconds would be fine, too.
>>
> I think the "age" function might do what you are looking for.
>
> http://www.postgresql.org/docs/8.2/interactive/functions-datetime.html
>
Not really.
The doc says age results to months and days.
I need minutes for intraday calculations.
There must be some more exact way to store time differences.
As far as I understood intervals are abstracts but no fix representation
of a distinct timespan, like INTERVAL '1 month' could equally be
February or August, even though August has more days.
It's still nice,too, to be able to add 2 months to a date and get the
same day 2 months later without considering the actual number of days
between the two dates.