note 30581 deleted from function.strtotime by sniper

From: Date: Tue, 21 Oct 2003 11:02:24 +0000
Subject: note 30581 deleted from function.strtotime by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59005@lists.php.net to get a copy of this message
Note Submitter: Anneoldon ---- Here is a function that calculate the difference between one date and now. $dif[2] is only used when the month is the same. I give the difference between days. function diffd($tims, &$dif) { $no = getdate(); $tims = strtotime($tims); $da = getdate($tims); if ($no["mon"]-$da["mon"]<0) { $moin=1; } elseif (($no["mon"]-$da["mon"]==0)&&($no["mday"]-$da["mday"]<0)) { $moin=1; } else $moin = 0; $dif[0]=$no["year"]-($da["year"]+$moin); if ($moin==1) { if ($dif[0]==0) $dif[1]=$no["mon"]-$da["mon"]; else $dif[1]=12-($no["mon"]-$da["mon"]); } else { $dif[1]=$no["mon"]-$da["mon"]; } $dif[2]=$no["mday"]-$da["mday"]; }

« previous php.notes (#59005) next »