note 80853 added to function.mcal-date-compare

From: Date: Mon, 04 Feb 2008 12:19:06 +0000
Subject: note 80853 added to function.mcal-date-compare
Groups: php.notes 
Request: Send a blank email to php-notes+get-135756@lists.php.net to get a copy of this message
/* a very short one and easy to understand */ /*mail me at: prem.sg.prem@gmail.com*/ /* reurns -1 if first given date is lower than the second */ /* reurns 0 if given dates are equal */ /* reurns 1 if second given date is lower than the first */ function date_compare($date1,$date2) { //parsing date1 to an array $darry1 $darray1 = (date_parse("$date1")); //parsing date2 to an array $darry2 $darray2 = (date_parse("$date2")); /* Assigning year,month & Day to the corresponding variables y ,m & d*/ echo $y1 = $darray1[year]."<br>"; echo $m1= $darray1[month]."<br>"; echo $d1= $darray1[day]."<br>"; echo $y2 = $darray2[year]."<br>"; echo $m2 = $darray2[month]."<br>"; echo $d2 = $darray2[day]."<br>"; if($y1 > $y2) { return 1; } elseif($y1 == $y2) { if($m1 > $m2) { return 1; } elseif($m1 == $m2) { if($d1 > $d2) { return 1; } elseif($d1 == $d2) { return 0; } else { return -1; } } else { return -1; } } else { return -1; } } ---- Server IP: 203.199.69.133 Probable Submitter: 203.200.157.178 ---- Manual Page -- http://www.php.net/manual/en/function.mcal-date-compare.php Edit -- https://master.php.net/note/edit/80853 Del: integrated -- https://master.php.net/note/delete/80853/integrated Del: useless -- https://master.php.net/note/delete/80853/useless Del: bad code -- https://master.php.net/note/delete/80853/bad+code Del: spam -- https://master.php.net/note/delete/80853/spam Del: non-english -- https://master.php.net/note/delete/80853/non-english Del: in docs -- https://master.php.net/note/delete/80853/in+docs Del: other reasons-- https://master.php.net/note/delete/80853 Reject -- https://master.php.net/note/reject/80853 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135756) next »