php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50631 strtotime() gives incorrect output for certain date
Submitted: 2010-01-02 06:04 UTC Modified: 2010-01-02 06:27 UTC
From: barlow at fhtsolutions dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.12 OS: Linux or XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: barlow at fhtsolutions dot com
New email:
PHP Version: OS:

 

 [2010-01-02 06:04 UTC] barlow at fhtsolutions dot com
Description:
------------
strtotime() reports an incorrect value for a particular date: 2010-03-15

It seems to think that this day has 23 hours!

Reproduce code:
---------------
---
From manual page: function.strtotime#Description
---
<?php
$a = strtotime("2010-03-14");
$b = strtotime("2010-03-15");

echo "Number of hours difference: ".(($b-$a)/3600)."<br />";

// shows 23 !  WRONG!
// PHP Version 5.2.12
?>

Expected result:
----------------
Number of hours difference: 24

Actual result:
--------------
Number of hours difference: 23

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-02 06:27 UTC] rasmus@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-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 28 01:01:27 2024 UTC