ID:               40744
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jeffkoston22 at yahoo dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: Slackware 11
 PHP Version:      5.2.1
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

01..08 are octal numbers.


Previous Comments:
------------------------------------------------------------------------

[2007-03-07 06:25:37] jeffkoston22 at yahoo dot com

Description:
------------
I'm not really fond of mktime() but I needed a way of taking two dates
in MySQL format and seeing which date is older... ie:

$date = "2007-03-01";
if ($date <= date('Y-m-d'))
{
  print "Expired";
} else {
  print "Not Expired";
}

I know you can't use dates like that in the condition so I used
date('U') and mktime() to give me the seconds since the Unix Epoch but
I decided to test using different date formats first just to see how
mktime handles months and years that might or might not have leading
zero's.. notice the difference in seconds with the year 08 vs. 07

please correct me if I'm doing something stupid here that I should not
be doing. 

I don't quite understand Bug #25050 - is this the same situation?
 
thanks for your time!

Reproduce code:
---------------
print "test1: " . date('U', mktime(0, 0, 0,  3, 1, 2008)) . "<br />";  
// 3-1-2008  returned 1204261200
print "test2: " . date('U', mktime(0, 0, 0,  3, 1,   08)) . "<br />";  
// 3-1-08    returned 951800400
print "test3: " . date('U', mktime(0, 0, 0, 03, 1, 2008)) . "<br />";  
// 03-1-2008 returned 1204261200
print "test4: " . date('U', mktime(0, 0, 0, 03, 1,   08)) . "<br />";  
// 03-1-08   returned 951800400

print "test5: " . date('U', mktime(0, 0, 0,  3, 1, 2007)) . "<br />";  
// 3-1-2007  returned 1172638800
print "test6: " . date('U', mktime(0, 0, 0,  3, 1,   07)) . "<br />";  
// 3-1-07    returned 1172638800
print "test7: " . date('U', mktime(0, 0, 0, 03, 1, 2007)) . "<br />";  
// 03-1-2007 returned 1172638800
print "test8: " . date('U', mktime(0, 0, 0, 03, 1,   07)) . "<br />";  
// 03-1-07   returned 1172638800

test1: 1204347600
test2: 951886800
test3: 1204347600
test4: 951886800

test5: 1172725200
test6: 1172725200
test7: 1172725200
test8: 1172725200


Expected result:
----------------
I expected to see:
test1: 1204347600
test2: 1204347600
test3: 1204347600
test4: 1204347600

test5: 1172725200
test6: 1172725200
test7: 1172725200
test8: 1172725200


Actual result:
--------------
instead I got:
test1: 1204347600
test2: 951886800
test3: 1204347600
test4: 951886800

test5: 1172725200
test6: 1172725200
test7: 1172725200
test8: 1172725200



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40744&edit=1

Reply via email to