note 40869 added to function.date
| From: | todor at todor dot net | Date: | Wed, 17 Mar 2004 14:54:03 +0000 |
| Subject: | note 40869 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66965@lists.php.net to get a copy of this message | ||
better this one ....
<?PHP
function min_date($a,$b){
if ( date('y',strtotime ($a)) < date('y',strtotime ($b)) ) return $a
;
elseif ( date('Y',strtotime ($a)) > date('Y',strtotime ($b)) )
return $b ;
elseif ( date('m',strtotime ($a)) < date('m',strtotime ($b))
) return $a ;
elseif ( date('m',strtotime ($a)) > date('m',strtotime
($b)) ) return $b ;
elseif ( date('d',strtotime ($a)) <
date('d',strtotime ($b)) ) return $a ;
elseif ( date('d',strtotime ($a)) >
date('d',strtotime ($b)) ) return $b ;
return $a ;
}
$dt1 = '01-JAN-73';
$dt2 = '15-OCT-06';
echo min_date($dt1,$dt2) ;
?>
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40869
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40869&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40869&report=yes
Search -- http://master.php.net/manage/user-notes.php