Un po' approssimato (considero 1 mese = 30 giorni) ma direi:
Non l'ho testato ma dovrebbe andareCodice PHP:
// Trovi ore minuti e secondi da DB
$giorni = 0;
$mesi = 0;
$anni = 0;
if ($ore > 24)
{
$giorni = floor($ore/24);
$ore = $ore % 24; // Questo trova il resto della divisione
}
if ($giorni > 30)
{
$mesi = floor($giorni)/30;
$giorni = $giorni % 30;
}
if ($mesi > 12)
{
$anni = floor($mesi)/12;
$mesi = $mesi % 12;
}