If you _do_ want to use this method for comparing dates (which isn't
realy a usual way of doing it... there date-functions) you should
fill up with leading 0's, like:

$date1="2001-01-07"; $date2="2001-01-14";

The reason is _very_ simple... You performing a text-compare here.
And let's face it... the characters "-1" (day of date2) are
"smaller" than "-7" (day in date1).

So...

RenzE


kaab kaoutar wrote:
> 
> Hi!
> 
> $date1="2001-1-7";$date2="2001-1-14";
> if ($date1>=$date2) echo "date1 is greater then date2";
> else echo "date2 is greater then date1";
> the result is the first :(
> but it works for other dates!
> 
> Thanks
> 
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to