Разница между датами
Code (php)
-
-
function timediff ($t1, $t2, $mode=3)
-
// $t1>$t2, modes:
-
// 5 - up to secs
-
// 4 - mins
-
// 3 - hours
-
// 2 - days
-
// 1 - months
-
-
{
-
-
$d = "YmdHis";
-
$sh = 0;
-
-
for ($i=$mode; $i>-1; $i–)
-
{
-
-
-
if ($df<0)
-
{
-
$sh=-1;
-
}
-
else
-
$sh=0;
-
-
$date[$i]=$df;
-
-
if ($df<>0) $t=$df.$n[$i].$t;
-
-
}
-
-
// return $date;
-
return $t;
-
-
-
}
-
автор: Дмитрий Смирнов
http://nudnik.ru/entry/3395

