Ouwe rakker |
|
Deze heb ik altijd gebruikt op een forum van me.
<?php
function ConvertTime($iTime=0) {
$rWeekCalc = ($iTime / 604800);
if ($rWeekCalc >= 1) {
$explode = explode('.', $rWeekCalc);
$iWeeks = $explode[0];
$iWeeksSeconds = ($iWeeks * 604800);
$lastchecked .= $iWeeks.' Weeks, ';
}
$rDayCalc = (($iTime - $iWeeksSeconds) / 86400);
if ($rDayCalc >= 1) {
$explode = explode('.', $rDayCalc);
$iDays = $explode[0];
$iDaysSeconds = ($iDays * 86400);
$lastchecked .= $iDays.' Days, ';
}
$rHourCalc = ((($iTime - $iWeeksSeconds) - $iDaysSeconds) / 3600);
if ($rHourCalc >= 1) {
$explode = explode('.', $rHourCalc);
$iHours = $explode[0];
$iHoursSeconds = ($iHours * 3600);
$lastchecked .= $iHours.' Hours, ';
}
$rMinutesCalc = (((($iTime - $iWeeksSeconds) - $iDaysSeconds) - $iHoursSeconds) / 60);
if ($rMinutesCalc >= 1) {
$explode = explode('.', $rMinutesCalc);
$iMinutes = $explode[0];
$iMinutesSeconds = ($iMinutes * 60);
$lastchecked .= $iMinutes.' Minutes, ';
}
$iSeconds = (((($iTime - $iWeeksSeconds) - $iDaysSeconds) - $iHoursSeconds) - $iMinutesSeconds);
$lastchecked .= $iSeconds.' Seconds';
return $lastchecked
}
?>
<?php function ConvertTime($iTime=0) { $rWeekCalc = ($iTime / 604800); if ($rWeekCalc >= 1) { $explode = explode('.', $rWeekCalc); $iWeeks = $explode[0]; $iWeeksSeconds = ($iWeeks * 604800); $lastchecked .= $iWeeks.' Weeks, '; } $rDayCalc = (($iTime - $iWeeksSeconds) / 86400); if ($rDayCalc >= 1) { $explode = explode('.', $rDayCalc); $iDays = $explode[0]; $iDaysSeconds = ($iDays * 86400); $lastchecked .= $iDays.' Days, '; } $rHourCalc = ((($iTime - $iWeeksSeconds) - $iDaysSeconds) / 3600); if ($rHourCalc >= 1) { $explode = explode('.', $rHourCalc); $iHours = $explode[0]; $iHoursSeconds = ($iHours * 3600); $lastchecked .= $iHours.' Hours, '; } $rMinutesCalc = (((($iTime - $iWeeksSeconds) - $iDaysSeconds) - $iHoursSeconds) / 60); if ($rMinutesCalc >= 1) { $explode = explode('.', $rMinutesCalc); $iMinutes = $explode[0]; $iMinutesSeconds = ($iMinutes * 60); $lastchecked .= $iMinutes.' Minutes, '; } $iSeconds = (((($iTime - $iWeeksSeconds) - $iDaysSeconds) - $iHoursSeconds) - $iMinutesSeconds); $lastchecked .= $iSeconds.' Seconds'; return $lastchecked } ?>
|