If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
I have a column(ex:Received_date) of type datetime. I want to find the number of hours in between the current datetime and Received_date.
Thanks in Advance.
create table test_date_time(
dt1 datetime year to fraction(5),
dt2 datetime year to fraction(5)
);
insert into test_date_time values("2008-11-17 07:01:45.000", "2008-11-18 07:01:45.000");
select (dt2 - dt1)::interval hour to hour from test_date_time;
drop table test_date_time;
As you can see, result from DATETIME - DATETIME is INTERVAL and you can CAST it on precision you want.
HTH