There's not much hint to it, here's a solution instead :)
You can make use of several built-in functions to handle strings, date/time values etc. Take a look at chapter 9: Functions and Operators of your PostgreSQL documentation all available functions are explained there.
To solve my problem I used the extract EXTRACT (field FROM source) function, as described in paragraph 9.8.1.
You can use it to extract a certain field form your timestamp vield, for example:
extract (hour from timestamp '2004-16-04 09:21:52') returns 9
SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');
EPOCH will return the number of seconds. You can multiply those by n*60, depending if you want minutes or hours.
At first I used a different calculation, but this one should be less work :).
I hope you're problem is solved that way.
I took the liberty of CC-ing the postgresql mailinglist so other's having a similar problem can read about this solution too. It's all about the (open-source)-community isn't it :)
From: togy(at)icube [mailto:martin(dot)tongel(at)icubestudio(dot)com]
Sent: dinsdag 15 juni 2004 19:08
To: Stijn Vanroye
Subject: Your question in postgresql.org forum
I read your question in postgresql.org forum published under sunject "Difference between two times as a numeric value in a stored procedure"
I am currently solving the same problem... Did you solve it somehow? Can you give a hint please?
pgsql-sql by date
|Next:||From: Christoph Haller||Date: 2004-06-16 11:52:57|
|Subject: How to delete the not DISTINCT ON entries|
|Previous:||From: Michalis Kabrianis||Date: 2004-06-16 06:47:17|
|Subject: Re: Last insert id|