OKyJIucT
3/25/2016 - 1:49 PM

dateDiffConvert

dateDiffConvert

function dateDiffConvert($diff) {

    $days = floor($diff / 86400);

    $hour = gmdate('H', $diff);
    $minutes = gmdate('i', $diff);
    $second = gmdate('s', $diff);

    $result = (intval($days) > 0 ? $days . ' д ' : '') . (intval($hour) > 0 ? $hour . ' ч ' : '') . (intval($minutes) > 0 ? $minutes . ' м ' : '') . $second . ' c ';
    return $result;
}