Okay, I've been trying to figure it out for hours and I'm tired because I know it isn't that difficult...guess it's just late and I can't think right. Anyways, so I have a lot of hours. Let's go with 8786 hours for example. I need to convert that to look like" years days ___ hours". Please help before my head explodes.
Convert Hours to Years/Days/Hours
There are lots of ways to do this. Here's one:
$num_hours = 8786;
$periods = array('years' => 365 * 24, 'days' => 24);
foreach ($periods as $key => $period) {
$per_num[$key] = floor($num_hours / $period);
$num_hours = $num_hours - ($per_num[$key] * $period);
}
$per_num['hours'] = $num_hours;
echo $per_num['years'] . ' year(s) ' .
$per_num['days'] . ' day(s) ' .
$per_num['hours'] . ' hour(s) ';