[PHP-DEV] Bug #14391: gmmktime, gmdate work incorrect
by other posts by this author
Dec 9 2001 12:29PM messages near this date
[PHP-DEV] Bug #11798 Updated: "svar_dump()" wanted
|
#14391 [NoF->Asn]: gmmktime, gmdate work incorrect
From: pilots@[...].net
Operating system: Windows 2000 Server
PHP version: 4.0.6
PHP Bug Type: Date/time related
Bug description: gmmktime, gmdate work incorrect
Please see the code below. The comments are the result of running this code
on my PC, (my GMT Offset = +2 hours = +7200 sec.)
You may see that the mktime() and date() functions work correct, but
gmmktime() returns wrong value in winter time (when it is not a daylight
saving time), and gmdate returns wrong "Z" parameter.
Note: this bug does not appear on UNIX systems.
<?
$df="d.m.Y - H:i:s (Z), I";
$t=mktime(0,0,0,1,2,1970);
echo "<br> <b>Make 02.01.1970 - 00:00:00 (Local):</b><br>",
"Timestamp: $t<br> ", // 79200
"GMT: ", gmdate($df,$t), "<br> ", // 01.01.1970 - 22:00:00 (7200)
"Local: ", date($df,$t), "<br> ", // 02.01.1970 - 00:00:00 (7200)
"----------------------------------------<br> ";
$t=gmmktime(0,0,0,1,2,1970);
echo "<br> <b>Make 02.01.1970 - 00:00:00 (GMT):</b><br>",
"Timestamp: $t<br> ", // 82800 (Why !=86400 ?)
"GMT: ", gmdate($df,$t), "<br> ", // 01.01.1970 - 23:00:00 (7200)
"Local: ", date($df,$t), "<br> ", // 02.01.1970 - 01:00:00 (7200)
"----------------------------------------<br> ";
$t=mktime(0,0,0,7,20,1970);
echo "<br> <b>Make 20.07.1970 - 00:00:00 (Local):</b><br>",
"Timestamp: $t<br> ", // 17269200
"GMT: ", gmdate($df,$t), "<br> ", // 01.07.1970 - 21:00:00 (7200)
"Local: ", date($df,$t), "<br> ", // 02.07.1970 - 00:00:00 (10800)
"----------------------------------------<br> ";
$t=gmmktime(0,0,0,7,20,1970);
echo "<br> <b>Make 20.07.1970 - 00:00:00 (GMT):</b><br>",
"Timestamp: $t<br> ", // 17280000 (=86400*200)
"GMT: ", gmdate($df,$t), "<br> ", // 02.07.1970 - 00:00:00 (7200)
"Local: ", date($df,$t), "<br> ", // 02.07.1970 - 03:00:00 (10800)
"----------------------------------------<br> ";
?>
--
Edit bug report at: http://bugs.php.net/?id=14391&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe@[...].net
For additional commands, e-mail: php-dev-help@[...].net
To contact the list administrators, e-mail: php-list-admin@lists.php.net
Thread:
lehresma at css dot tayloru dot edu
keath at keathmilligan dot net
f dot vulto at re-base dot com
nospam at no-spam dot com
|