Bug #10694: mktime leap year bug
| From: | schnitten at gmx dot at | Date: | Sun, 06 May 2001 23:50:21 +0000 |
| Subject: | Bug #10694: mktime leap year bug | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-54168@lists.php.net to get a copy of this message | ||
From: schnitten@gmx.at
Operating system: Redhat 6.2
PHP version: 4.0.4
PHP Bug Type: Date/time related
Bug description: mktime leap year bug
first of all:
I use php 4.0.1pl2 and don't have the possibility to upgrade. Please verify with latest
version.
I tried to add 12 months to a given timestamp and figured out that mktime() doesn't include a
29th February into its calculations. Effect is, that following code doesn't jump forward 1 year
during each loop. Every leap year 1 day gets lost!
$a = mktime(0,0,0,1,1,1970);
for ($i=0; $i<20; $i++) {
$a = mktime(0,0,3600 +$a,1+12,1,1970);
$b = date("d-m-Y", $a);
print "Date: $b<br>";
}
--
Edit Bug report at: http://bugs.php.net/?id=10694&edit=1