Decimal minutes

Hi, not sure if this is a suitable forum for this, but does anyone know a formula for converting decimal time to hours and minutes?

IE 1.4 = 1hr 24mins

thanks for any help and sorry if this is the wrong forum

+4
source share
4 answers
$decTime = 1.4; $hour = floor($decTime); $min = round(60*($decTime-$hour)); 
+12
source

Just take the decimal part of the clock and multiply by 60 for the number of minutes.

In your example .4 (the decimal portion of 1.4) * 60 = 24 minutes

So, if you need to do this in code, subtract the floor of the original number from the original number to get the decimal part.

+4
source

Clock: gender (decimal)

Minutes: round ((decimal * 60) mod 60)

James is right about rounding. I forgot to explain it. Adjusted.

+2
source

Put the number to find out how many hours. Number - full value [decimal] * 60 = minutes [round it after]

+1
source

Source: https://habr.com/ru/post/1307070/