|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-08-22 10:34 UTC] piefra at gmail dot com
Description:
------------
(sorry for my english i'm french )
using timestamp incrementation with date(H), i found somme datetime error :
the error occur on the same hours ( 02:00 )
echo date("Y/m/d H:i",gmmktime(2,0,0,03,25,2007)) -> 2007/03/25 03:00
reproductible on every years same month ( end mars )
2007/03/25 03:00,2008/03/30 03:00,2009/03/29 03:00,2010/03/28 03:00
2011/03/27 03:00,2012/03/25 03:00,2013/03/31 03:00,2014/03/30 03:00
2015/03/29 03:00 ...
to find date errors run the code
found on windows/wamp 1.5.0 (php 5.1)
tested on linux/mandriva/appache with php 4.1
all plateform test is x86
Reproduce code:
---------------
<?php
session_cache_expire (0);
echo '<pre>';
$dt1=mktime(0,0,0,1,1,2007);
echo date("Y/m/d H:i",$dt1)."\n";
for ($i=1;$i<24*365*20;$i++){
set_time_limit(0);
$dt2=mktime(date("H",$dt1)+1,date("i",$dt1),0,date("m",$dt1),date("d",$dt1),date("Y",$dt1));
$d=date("H",$dt2)-date("H",$dt1);
if ($d<>1 and $d <>-23) {
echo date("Y/m/d H:i",$dt1)." ".date("Y/m/d H:i",$dt2)."\n";
flush();
}
$dt1=$dt2;
}
echo date("Y/m/d H:i",$dt2)."\n";
echo '<pre>';
?>
Expected result:
----------------
echo date("Y/m/d H:i",gmmktime(2,0,0,03,25,2007)) -> 2007/03/25 02:00
Actual result:
--------------
echo date("Y/m/d H:i",gmmktime(2,0,0,03,25,2007)) -> 2007/03/25 03:00
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 18:00:01 2025 UTC |
sorry im ' done a wrote error the exact fonction is mktime (not gmmktime ) expected result: echo date("Y/m/d H:i",mktime(2,0,0,03,25,2007)) -> 2007/03/25 02:00 actual result: echo date("Y/m/d H:i",mktime(2,0,0,03,25,2007)) -> 2007/03/25 03:00