-
i want to be able to substract date2 from date1 and display only hours and minutes, not mon, year, day or seconds; just hours and minutes.
example
date1 = 12/01/2001 21:00
date2 = 01/01/2002 06:00
when I do the substraction, I get say, 9:0
I need to display 09:00
can anyone help please?
-
Can you give a valid example of what you need ?
svk
-
I have two dates in the format mm/dd/yyyy HH24:mi.
I want to substract date2 from date1 and get the result in HH:MI
for instance:
date1 = 12/01/2001 21:00 --month/Day/YYYY Hours:Minutes
date2 = 12/01/2001 06:00 --month/Day/YYYY Hours:Minutes
When I substract date2 from date1, I want my result to be 09:00. Right now, the result is 9:0.
-
Still, what I do not understand is how the result is 9:0 ?
6am to 9pm on same date should be 15hrs. So, is that you want to see '15:00' as result ?
svk
-
Yes I want to see 15:00.
the actual test data are:
date1 = 01/22/2002 21:00
date2 = 01/22/2002 06:00
and the result is coming out as 9:0
but the point I was trying to stress is I want 09:00
as opposed to 9:00.
Thanks again for all replies.
-
Here it is :
select to_char(trunc(sysdate)+(to_date('12/01/2001 21:00','MM/DD/YYYY HH24:MI')-to_date('12/01/2001 06:00','MM/DD/YYYY HH24:MI')),'HH24:MI') from dual;
svk
-
thanks svk, i really appreciate it!
-
SELECT TO_CHAR(SYSDATE, 'HH24:MI') FROM DUAL;
That's all.
F.
-
Mnemonical, did you read my question?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|