How to convert minutes to hours and minutes (without days)

data-conversion, date, php, time

Solution

You can use:

$minutes=1510;

$hours = intdiv($minutes, 60).':'. ($minutes % 60);

!!! This only works with php >= v7.xx

Previous answer:

$minutes=1510;

$hours = floor($minutes / 60).':'.($minutes -   floor($minutes / 60) * 60);

Problem

I would like to display time in minues as an hour and minutes. Example 1: I want to display 125 minutes as a 2:05 I know I can to somethink like: ``` $minutes=125; $converted_time = date('H:i', mktime(0,$minutes); ``` This works fine, but if the time is more then 24h it is a problem. Example 2: ``` $minutes=1510; ``` and I want to receive 25:10 (without days), only hours and minutes. How to do that?

Original source

Related problems