From:             [EMAIL PROTECTED]
Operating system: FreeBSD 4.5
PHP version:      4.1.2
PHP Bug Type:     Date/time related
Bug description:  mktime() when passed a 0 for the day of the month to get the last 
day is broken

When you use mktime(0,0,0,<month>,<day>,<year>) and specify 0 as the day to
get the last day of the month, the last day of the month returned is off.
It seems that the months are all off by 1 after January. So with mktime(),
for February, the last day is the 31st, for March it is the 28th, for
April it is the 31st, etc. And instead February should be the 28th, March
the 31st, and April the 30th, etc...

<?php
  //Last day should be 28, but is 31
  $day = getdate( mktime(0,0,0,2,0,2002) );
  print 'The last day for February is: ' . $day[mday]
        .'<br>';
  //Last day should be 31, but is 28
  $day = getdate( mktime(0,0,0,3,0,2002) );
  print 'The last day for March is: ' . $day[mday];
  
?>
-- 
Edit bug report at http://bugs.php.net/?id=16594&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=16594&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=16594&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=16594&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=16594&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=16594&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=16594&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=16594&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=16594&r=submittedtwice

Reply via email to