note 36796 deleted from function.mktime by sniper

From: Date: Tue, 04 Nov 2003 13:09:13 +0000
Subject: note 36796 deleted from function.mktime by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-59858@lists.php.net to get a copy of this message
Note Submitter: aprilchong@hotmail.com ---- This function cals the different days between today and given date. function daysDiff($y1, $m1, $d1) { $y2 = date("Y"); $m2 = date("m"); $d2 = date("d"); $y = $y1 - $y2; $m = $m1 - $m2; $d = $d1 - $d2; $daysInMonth = date("t",$m1); if ($d<0) {$m--;$d=$d+$daysInMonth;} if ($m<0) {$y--;$m=$m+12;} if ($y) $diff .= $y==1 ? "1 year " : "$y years "; if ($m) $diff .= $m==1? "1 month and " : "$m months and "; if ($d) $diff .= $d==1 ? "1 day " : "$d days "; return $diff; } April :)

« previous php.notes (#59858) next »