How to calculate hour:minutes from total minutes?

前端 未结 4 1258
情话喂你
情话喂你 2021-01-12 08:03

For example i have 525 minutes, if we will divide it by 60 the result will be 8.75

But 1 hour have only 60 minutes not 75

How can i calculate the exact hour

4条回答
  •  囚心锁ツ
    2021-01-12 08:52

    $hours = intval($totalMinutes/60);
    $minutes = $totalMinutes - ($hours * 60);
    

    Edited to be PHP

提交回复
热议问题