From: [EMAIL PROTECTED]
Operating system: SunOS
PHP version: 4.2.0
PHP Bug Type: Date/time related
Bug description: Possible problem with date function?
Having a problem with date(). I simplified the program I am working on
so you can copy and paste the code and see the problem right away.
I start with the month of october and year of 2002 ($month and $year).
I convert that to the POSIX time ($time) of the the first second of
that month.
Then, I keep adding 24*3600 seconds to that time until the end of the
month.
If you run the program, you will see I get TWO 27/10/2002 -- WHY??
WHY? WHY? WHY?
Here is the code:
================ START CODE =======================
$year = "2002";
$month = "10";
$time = mktime (0,0,0,$month,1,$year);
$last_day_of_the_month = date("t",$time);
echo "Last day of the month ($month/$year):
$last_day_of_the_month<br><br>";
for ($day=1;$day<=$last_day_of_the_month;$day++) {
$new_time = $time + ($day-1)*24*3600;
echo date("m/d/Y",$new_time);
echo " (seconds added to original time: ".(($day-1)*24*3600).")";
echo "<br>";
}
=================== END CODE =====================
--
Edit bug report at http://bugs.php.net/?id=19458&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19458&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19458&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19458&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19458&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19458&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19458&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19458&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19458&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19458&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19458&r=globals