Jamie
Jamie

Reputation: 373

How to convert hours to minutes?

When I use decimals in the formula it works like how it should work. It shows perfectly the hours and minutes (hh:mm). The problem starts when I use integers like 45 in the example below. The result is 0 which is pretty logical. Actually what I want is the outcome "45:0". What do I need to do to the following code:

WHEN MOD(ROUND((45) * 60), 60) > 9 THEN
  to_char(FLOOR((45))) || ':' || MOD(ROUND(ABS((45)) * 60), 60)
ELSE
  "0:00"

Hope someone else could help me out with this.

Thank you! :)

Upvotes: 1

Views: 82

Answers (1)

Nasir Iqbal
Nasir Iqbal

Reputation: 872

Your formula is good, you just need to remove the WHEN condition along with ELSE part.

Or let us know its purpose ! why you want to use 0:00 when minute part is 9 or less then 9 (i.e after point / fraction part is lower then .15 or no fraction at all)

Upvotes: 1

Related Questions