php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81093 different time give same date
Submitted: 2021-05-31 22:01 UTC Modified: 2021-05-31 22:12 UTC
From: sylvain dot rochette at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS: linux
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: sylvain dot rochette at gmail dot com
New email:
PHP Version: OS:

 

 [2021-05-31 22:01 UTC] sylvain dot rochette at gmail dot com
Description:
------------
php5.7, i cannot use a recent version but I think this issue is still there

The problem that I don't understand is a date come 2 times, with different time value. EXACT SAME TIME for about 1h in total

The example I give start at 

2020-11-01 00:45:00 1604205900
2020-11-01 00:50:00 1604206200
2020-11-01 00:55:00 1604206500
2020-11-01 01:00:00 1604206800

but after few 5 min jump (300)

it return back to 

2020-11-01 01:00:00 1604210400

even if the time is different, I just don't understand, if you continue it will get to 2 hours and it's fine but just this sequence does not work.

I try the first 11 months without any issue until I get to this date!!

The only thing I see is they are big number but still it continue fine, The thing is, php seam to have a bug (hardcoded) related to this date, I say PHP it's maybe linux, I just don't understand it...

My concern is date >= then 1604210400 are all BAD...

Please help me to understand the issue I am stuck with that lol, a bug from date("Y-m-d H:i:s", $i)??? 

Test script:
---------------
for ($i = 1604205900; $i <= 1604211000; $i += 300) {
    $time = date("Y-m-d H:i:s", $i);
    echo ($time."    ".$i."<BR/>");
}

Expected result:
----------------
2020-11-01 00:45:00 1604205900
2020-11-01 00:50:00 1604206200
2020-11-01 00:55:00 1604206500
2020-11-01 01:00:00 1604206800
2020-11-01 01:05:00 1604207100
2020-11-01 01:10:00 1604207400
2020-11-01 01:15:00 1604207700
2020-11-01 01:20:00 1604208000
2020-11-01 01:25:00 1604208300
2020-11-01 01:30:00 1604208600
2020-11-01 01:35:00 1604208900
2020-11-01 01:40:00 1604209200
2020-11-01 01:45:00 1604209500
2020-11-01 01:50:00 1604209800
2020-11-01 01:55:00 1604210100

2020-11-01 02:00:00 1604210400
2020-11-01 02:05:00 1604210700
2020-11-01 02:10:00 1604211000

Actual result:
--------------
2020-11-01 00:45:00 1604205900
2020-11-01 00:50:00 1604206200
2020-11-01 00:55:00 1604206500
2020-11-01 01:00:00 1604206800
2020-11-01 01:05:00 1604207100
2020-11-01 01:10:00 1604207400
2020-11-01 01:15:00 1604207700
2020-11-01 01:20:00 1604208000
2020-11-01 01:25:00 1604208300
2020-11-01 01:30:00 1604208600
2020-11-01 01:35:00 1604208900
2020-11-01 01:40:00 1604209200
2020-11-01 01:45:00 1604209500
2020-11-01 01:50:00 1604209800
2020-11-01 01:55:00 1604210100

2020-11-01 01:00:00 1604210400
2020-11-01 01:05:00 1604210700
2020-11-01 01:10:00 1604211000

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-31 22:03 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2021-05-31 22:03 UTC] requinix@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.


 [2021-05-31 22:12 UTC] sylvain dot rochette at gmail dot com
I try the sandbox and it work, it seam my 5.6.35 php is buggy on my domain. Not quite sure of the issue...
 [2021-05-31 22:14 UTC] sylvain dot rochette at gmail dot com
the sandbox show different date compare to what I get, few hours decay it is really wierd, I get that on the sandbox

2020-10-31 21:45:00    1604205900
2020-10-31 21:50:00    1604206200
2020-10-31 21:55:00    1604206500
2020-10-31 22:00:00    1604206800
2020-10-31 22:05:00    1604207100
2020-10-31 22:10:00    1604207400
2020-10-31 22:15:00    1604207700
2020-10-31 22:20:00    1604208000
2020-10-31 22:25:00    1604208300
2020-10-31 22:30:00    1604208600
2020-10-31 22:35:00    1604208900
2020-10-31 22:40:00    1604209200
2020-10-31 22:45:00    1604209500
2020-10-31 22:50:00    1604209800
2020-10-31 22:55:00    1604210100
2020-10-31 23:00:00    1604210400
2020-10-31 23:05:00    1604210700
2020-10-31 23:10:00    1604211000
 [2021-06-01 02:46 UTC] a at b dot c dot de
Presumably the sandbox you're talking about is running in a different timezone than the you're using (one three hours to the west). See requinix's comment about Daylight Saving.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 18:01:29 2024 UTC