note 78860 added to function.mcal-date-compare
| From: | nepnep_athotmaildotcom at osu1 dot php dot net | Date: | Wed, 31 Oct 2007 05:46:24 +0000 |
| Subject: | note 78860 added to function.mcal-date-compare | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131847@lists.php.net to get a copy of this message | ||
/* this is much a much better code */
/* a very short one and easy to understand */
/* 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($y1,$m1,$d1,$y2,$m2,$d2){
/* check the year */
if($y1 > $y2){
/* if $y1 is greater then therefore the first date is greater than second */
return 1;
}elseif($y1 == $y2){
/* equal year, check the month */
if($m1 > $m2){
/* year is equal but the first given month is greater
/* therefore the first given date is greater */
return 1;
}elseif($m1 == $m2){
/* if month are also equal, check the date */
if($d1 > $d2){
return 1;
}elseif($d1 == $d2){
return 0;
}else{
return -1;
}
}else{
/* if year is equal but month is less, therefore the first given date is less */
return -1;
}
}else{
/* if $y1 is less than $y2 */
return -1;
}
}
----
Server IP: 69.147.83.197
Probable Submitter: 203.177.140.86
----
Manual Page -- http://www.php.net/manual/en/function.mcal-date-compare.php
Edit -- https://master.php.net/note/edit/78860
Del: integrated -- https://master.php.net/note/delete/78860/integrated
Del: useless -- https://master.php.net/note/delete/78860/useless
Del: bad code -- https://master.php.net/note/delete/78860/bad+code
Del: spam -- https://master.php.net/note/delete/78860/spam
Del: non-english -- https://master.php.net/note/delete/78860/non-english
Del: in docs -- https://master.php.net/note/delete/78860/in+docs
Del: other reasons-- https://master.php.net/note/delete/78860
Reject -- https://master.php.net/note/reject/78860
Search -- https://master.php.net/manage/user-notes.php