$days = int($time/86400); $time %= 86400; # leave only the part that's less than a day $hours = int($time/3600); $time %= 3600; # leave only the part that's less than an hour; ... # and so on