Quote:
Originally Posted by csckid
finish_time , arrival_time these are time without time zone.
finish_time "05:01:01"
arrival_time "03:02:02"
I would expect the answer to be 08:03:03
|
Sorry I didn't see that those were not columns of type
date (mainly because you wrote "how can I add two
dates"

)
Unfortunately you can only add an interval to a time value. But with a little trick you can "convert" the time into an interval:
Code:
SELECT finish_time + (interval '1' second) * extract(epoch from time arrival_time)
FROM your_table
This works as follows:
extract(epoch from time arrival_time) converts the time into seconds. Those seconds are then "converted" to an interval by multiplying a one second interval with them. The resulting interval can then be added to the date value.