What I did:
SELECT TO_CHAR(SYSDATE, 'HH24:MI') FROM dual;
What i got:
13:30
What I want :
13.50
I also tried the EXTRACT function then summed hours and minutes but still not working.
If you want the actual time (not just hours and minutes), you can do:
select ( sysdate - trunc(sysdate) ) * 24, sysdate
from dual;
If you just want just hours and minutes:
select extract(hour from current_timestamp) + extract(minute from current_timestamp) / 60
from dual
If you want the time-of-day (hours, minutes and seconds) expressed in fractional hours, then you can use
( sysdate - trunc(sysdate) ) * 24
as Gordon has shown already.
If you want to truncate the seconds and just convert the hour and minute into hours, then you can use
( trunc(sysdate, 'mm') - trunc(sysdate) ) * 24
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With