php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54036 Mktime issue arround march 26th
Submitted: 2011-02-17 16:23 UTC Modified: 2011-02-17 16:29 UTC
From: antoine at arcantia dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: antoine at arcantia dot com
New email:
PHP Version: OS:

 

 [2011-02-17 16:23 UTC] antoine at arcantia dot com
Description:
------------
Hi,

Mktime returns bad value when we worl on marchs date.
The diffrence bettween dates is wrong.

Test script:
---------------
<?

$du ="26/03/2011";
$au ="28/03/2011";

$duArr = explode("/", $du);
$auArr = explode("/", $au);

$hour = 0;//date("H");
		$minute = 0;//date("i");
		$second = 0;//date("s");
		$date1 = mktime($hour,$minute,$second,intval($duArr[1]),intval($duArr[0]),intval($duArr[2]));
		$date2 = mktime($hour,$minute,$second,intval($auArr[1]),intval($auArr[0]),intval($auArr[2]));

$diffDate = $date2 - $date1;
		$diffJours = floor($diffDate/(60*60*24));


echo $diffJours."<br>";

?>

Expected result:
----------------
Must return 2



Actual result:
--------------
Returning 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-02-17 16:29 UTC] derick@php.net
-Status: Open +Status: Bogus
 [2011-02-17 16:29 UTC] derick@php.net
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.

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 14:01:33 2025 UTC