Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert minutes to HH24:MI format

Can you please help in converting minutes to the format of ('HH24:MI').

I am getting the result in integer which is the minutes. So, how to convert them?

Thanks

like image 771
ZEE Avatar asked Oct 28 '25 04:10

ZEE


1 Answers

Assuming, you want to convert 492 minutes:

select to_char(trunc(sysdate) + 492/24/60, 'hh24:mi') from dual;

If you want a function:

create or replace 
  function tq84_convert_minutes_hh24mm (p_minutes in number) 
  return varchar2 is
begin

    return to_char (trunc(sysdate) + p_minutes / 24/60, 'hh24:mi');

end tq84_convert_minutes_hh24mm;
/

Later ...

begin
  dbms_output.put_line (tq84_convert_minutes_hh24mm(492));
end;
/
like image 178
René Nyffenegger Avatar answered Oct 30 '25 03:10

René Nyffenegger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!