ID:               16594
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         Date/time related
 Operating System: FreeBSD 4.5
 PHP Version:      4.1.2
 Assigned To:      hholzgra


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

[2002-04-14 08:34:12] [EMAIL PROTECTED]

intended behaviour

day zero is the day before the first day of
the given month, so it is obviously the last
day of the month *before* the given one

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

[2002-04-14 02:34:05] [EMAIL PROTECTED]

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 this bug report at http://bugs.php.net/?id=16594&edit=1

Reply via email to