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!

Converting Decimal time to HH:MM:SS

SolHillJun 22 2010 — edited Jun 22 2010
I have a seeded oracle elements tables containing hours in a decimal format. Such as:

35.33333333333333333333

This equates to 35 hours 20 mins, and is displayed as such in the Oracle financials front end. (35:20). I am writing a report to pull out these hours, however I’m getting rounding issues.

Select numtodsinterval(35.33333333333333333333, 'HOUR' ) from dual

Returns: +000000001 11:19:59.999999999

from this I can extract the minutes and seconds then concatenate with trunc(35.33333333333333333333) which gives me 35:19 (not what I needed)

I have tried extracting the seconds and rounding the number which gives me 60 but this can be used date arithmetic as a seconds value to add it to the number as seconds are 1-59

There must be a way of doing this, over all I need to be confident that what I return is going to match what the users see on the front end so writing something custom without knowing the real mechanics behind the figure displayed by oracle won’t give me what I need.

Hope somebody can help
Sol
This post has been answered by Frank Kulash on Jun 22 2010
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2010
Added on Jun 22 2010
3 comments
3,239 views