Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

#32452 [NEW]: Compare dates impossible with mktime

0 views
Skip to first unread message

arnoud dot kettenis at planet dot nl

unread,
Mar 25, 2005, 6:15:31 AM3/25/05
to
From: arnoud dot kettenis at planet dot nl
Operating system: Windows 2000
PHP version: 4.3.10
PHP Bug Type: Date/time related
Bug description: Compare dates impossible with mktime

Description:
------------
Compare dates impossible with mktime. All if-statements return true, no
matter the date.

Reproduce code:
---------------
<?php
$event_fromdate = date("Y-m-d", mktime(0, 0, 0, 5, 1, 2005));
$event_todate = date("Y-m-d", mktime(0, 0, 0, 5, 10, 2005));
if ($event_todate >= $event_formdate) {echo ("<p>equal or
larger</p>\n");}else {echo ("<p>smaller</p>\n");}

$event_todate = date("Y-m-d", mktime(0, 0, 0, 5, 1, 2005));
if ($event_todate >= $event_formdate) {echo ("<p>equal or
larger</p>\n");}else {echo ("<p>smaller</p>\n");}

$event_todate = date("Y-m-d", mktime(0, 0, 0, 4, 10, 2003));
if ($event_todate >= $event_formdate) {echo ("<p>equal or
larger</p>\n");}else {echo ("<p>smaller</p>\n");}
?>

Expected result:
----------------
equal or larger

equal or larger

smaller


Actual result:
--------------
equal or larger

equal or larger

equal or larger


--
Edit bug report at http://bugs.php.net/?id=32452&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32452&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32452&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32452&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32452&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32452&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32452&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32452&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32452&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32452&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32452&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32452&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32452&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32452&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32452&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32452&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32452&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32452&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32452&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32452&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32452&r=mysqlcfg

0 new messages