Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Difference between Date in HH:MM

user12009546Jul 17 2012 — edited Jul 31 2012
Hi,

I'm having following table, I want the difference between the time in HH:MM:SS & another output as HH:MM with seconds rounded.


CREATE TABLE "ITIP"."TOTO"
( "N1" VARCHAR2(100),
"DT1" DATE,
"DT2" DATE
)


insert into TOTO (n1, dt1, dt2)
values ('TT', to_date('25-06-2012 10:46:56', 'dd-mm-yyyy hh24:mi:ss'), to_date('25-06-2012 10:51:53', 'dd-mm-yyyy hh24:mi:ss'));
insert into TOTO (n1, dt1, dt2)
values ('TT', to_date('25-06-2012 10:51:53', 'dd-mm-yyyy hh24:mi:ss'), to_date('25-06-2012 10:51:57', 'dd-mm-yyyy hh24:mi:ss'));
insert into TOTO (n1, dt1, dt2)
values ('TT', to_date('25-06-2012 10:32:06', 'dd-mm-yyyy hh24:mi:ss'), to_date('25-06-2012 10:43:09', 'dd-mm-yyyy hh24:mi:ss'));
insert into TOTO (n1, dt1, dt2)
values ('TT', to_date('25-06-2012 10:43:09', 'dd-mm-yyyy hh24:mi:ss'), to_date('25-06-2012 10:53:09', 'dd-mm-yyyy hh24:mi:ss'));
insert into TOTO (n1, dt1, dt2)
values ('UU', to_date('25-06-2012 10:46:56', 'dd-mm-yyyy hh24:mi:ss'), to_date('25-06-2012 21:44:39', 'dd-mm-yyyy hh24:mi:ss'));
insert into TOTO (n1, dt1, dt2)
values ('UU', to_date('27-06-2012 10:51:53', 'dd-mm-yyyy hh24:mi:ss'), to_date('27-06-2012 11:46:10', 'dd-mm-yyyy hh24:mi:ss'));
insert into TOTO (n1, dt1, dt2)
values ('UU', to_date('28-06-2012 10:32:06', 'dd-mm-yyyy hh24:mi:ss'), to_date('28-06-2012 18:45:32', 'dd-mm-yyyy hh24:mi:ss'));
insert into TOTO (n1, dt1, dt2)
values ('UU', to_date('29-06-2012 14:22:13', 'dd-mm-yyyy hh24:mi:ss'), to_date('29-06-2012 17:24:20', 'dd-mm-yyyy hh24:mi:ss'));
commit;


What is the output when we subtract two dates?, Also I want the difference between the time in HH:MM:SS & another output as HH:MM with seconds rounded.

Please suggest a query for the same.

Thanks
This post has been answered by Frank Kulash on Jul 17 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 28 2012
Added on Jul 17 2012
11 comments
3,377 views