Bug #51613 [Opn->Bgs]: Ugly Error in date() and strtotime()

[email protected]
Newsgroups php.bugs
Message-ID <[email protected]>
Edit report at http://bugs.php.net/bug.php?id=51613&edit=1

 ID:               51613
 Updated by:       [email protected]
 Reported by:      contact at vladrotariu dot com
 Summary:          Ugly Error in date() and strtotime()
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          Date/time related
 Operating System: Ubuntu 9.10
 PHP Version:      5.3.2

 New Comment:

We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which do
not suffer from DST.




Previous Comments:
------------------------------------------------------------------------
[2010-04-20 11:22:20] contact at vladrotariu dot com

Description:
------------
When you try to create a succession of months using the following code,
you will notice a very ugly bug that results in skipping months

Test script:
---------------
for(
				$i = strtotime("2004-10-01" );
				$i <= mktime();
				$i += (24*60*60 * cal_days_in_month( CAL_GREGORIAN, date("m", $i),
date("Y", $i) ))
			) {
				$year_month = date("Ymd H:i:s", $i);
				echo "<br />".$year_month;
			}

Expected result:
----------------
20041001 00:00:00
20041101 00:00:00
20041201 00:00:00

Actual result:
--------------
20041001 00:00:00
20041031 23:00:00
20041201 23:00:00


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



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51613&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.