Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.0k views
Welcome To Ask or Share your Answers For Others

1 Answer

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;
/

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...