Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Convert minutes to hours:minutes

PugzlyAug 18 2022

I stumbled on a piece of code, which converts minutes to hours:minutes and appears to work fine.

I was hoping that someone can tell me what the '09' does. It looks to be some sort of format but I couldn't seem to find any references to it.

My goal is to create a function to achieve this task. Thanks in advance to all that answer and for your expertise.

WITH c AS (SELECT 492 AS MINUTES FROM DUAL)
SELECT trim(to_char(trunc(MINUTES / 60), '09')) || ':' ||
trim(to_char(trunc(mod(abs(MINUTES), 60)), '09')) AS HHMM
FROM c; 

08:12
This post has been answered by User_3ABCE on Aug 18 2022
Jump to Answer
Comments
Post Details
Added on Aug 18 2022
7 comments
1,526 views