note 43016 rejected from function.mktime by vincent

From: Date: Wed, 09 Jun 2004 21:18:53 +0000
Subject: note 43016 rejected from function.mktime by vincent
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-70565@lists.php.net to get a copy of this message
Note Submitter: shadow2day@yahoo.com ---- can't figure out what's wrong with this..anyone -- <? ######################### # date_diff Function ######################### # # Calculate the difference between 2 dates in YYYY-MM-DD format. # Returns the number of days difference. if (date_diff($today, $end_date) > 0) { echo 'Active'; } else { echo 'Expired'; }; function date_diff($today, $end_date) { $today=now(); $d1 = explode("-", $today); $y1 = $d1[0]; $m1 = $d1[1]; $d1 = $d1[2]; $d2 = explode("-", $end_date); $y2 = $d2[0]; $m2 = $d2[1]; $d2 = $d2[2]; $today_set = mktime(0,0,0, $m1, $d1, $y1); $end_date_set = mktime(0,0,0, $m2, $d2, $y2); return(round(($end_date_set-$today_set)/(60*60*24))); } ; ?>

« previous php.notes (#70565) next »