How to convert number 1.33408564814814 to time 32:01:05?
If you actually want the result as a character string, you could use a function like this:
set serveroutput on format wrapped;
declare
function days_to_time (p_days number) return varchar2
is
d number := p_days;
h integer;
m integer;
s integer;
begin
h := trunc(d*24);
d := d - h/24;
m := trunc(d*24*60);
d := d - m/24/60;
s := round(d*24*60*60);
return(h||':'||to_char(m,'FM00')||':'||TO_CHAR(s,'FM00'));
end;
begin
dbms_output.put_line(days_to_time(1.33408564814814));
end;
/
anonymous block completed
32:01:05
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