Re: Date comparison going wrong, wrong, wrong
| From: | marco@behnke.biz | Date: | Mon, 12 Nov 2012 09:05:35 +0000 |
| Subject: | Re: Date comparison going wrong, wrong, wrong | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319688@lists.php.net to get a copy of this message | ||
"Terry Ally (Gmail)" <terryally@gmail.com> hat am 11. November 2012 um 19:30
geschrieben:
> Hi all,
>
> I am having a problem with comparing time. I am using the following:
>
> $todaydate = date("D, M jS, Y g:i:s a");
> $showenddate = date("D, M jS, Y g:i:s a",
> strtotime($showsRecord['end_date']));
>
> if ($todaydate > $showenddate):
Read about http://de1.php.net/manual/en/datetime.diff.php
> echo "The date of the show has not yet arrived";
> else:
> echo "The show has ended";
> endif;
>
> The problem that I am encountering is that PHP is rendering the reverse of
> the equation. For example:
>
> If today's date is *11 Nov 2012* and the show's end date is *18 Nov 2012*,
> the message that I am getting is *the show has ended* which is wrong. A
> test example is at http://www.lakesidesurrey.co.uk/test.php.
>
> You can also me what I am doing wrong?
>
> Thanks
> Terry
--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3
Tel.: 0174 / 9722336
e-Mail: marco@behnke.biz
Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal
http://www.behnke.biz