Hello Martin,
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:
Functionsand 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');
Result: 442800
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
solutiontoo. It's all about the (open-source)-community isn't it :)
Kind regards,
Stijn Vanroye
-----Original Message-----
From: togy@icube [mailto:martin.tongel@icubestudio.com]
Sent: dinsdag 15 juni 2004 19:08
To: Stijn Vanroye
Subject: Your question in postgresql.org forum
Hello Stijn,
I read your question in postgresql.org forum published under sunject "Difference between two times as a numeric value
ina stored procedure"
I am currently solving the same problem... Did you solve it somehow? Can you give a hint please?
Best Regards,
Martin Tongel