Bug #74691 [Nab]: Novosibirsk Data Time Anomaly
| From: | karpulix at ya dot ru | Date: | Tue, 06 Jun 2017 05:56:53 +0000 |
| Subject: | Bug #74691 [Nab]: Novosibirsk Data Time Anomaly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-209387@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74691&edit=1
ID: 74691
User updated by: karpulix at ya dot ru
Reported by: karpulix at ya dot ru
Summary: Novosibirsk Data Time Anomaly
Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: All
PHP Version: 7.1.5
Block user comment: N
Private report: N
New Comment:
Because regardless of the time zone in the period beetween from 02.06.2015 to 02.06.2017 should be
the same number of seconds. This is an axiom. No?
------------
ÐоÑÐ¾Ð¼Ñ ÑÑо незавиÑимо оÑ
ÑаÑового поÑÑа в пÑомежÑÑке
Ð¾Ñ 02.06.2015 до 02.06.2017 должно бÑÑÑ
одинаковое колиÑеÑÑво
ÑекÑнд. ÐÑо акÑиома.
Previous Comments:
------------------------------------------------------------------------
[2017-06-04 08:58:29] heiglandreas@php.net
Why do you think the diff doesn't provide the data correctly? After all there IS one hour
missing in the diff.
You might want something different from it but that's a different story. The difference between
anytime on the 2nd of June 2015 in "Asia/Novosibirsk" and the same time on the 2nd of June
2017 in Asia/Novosibirsk is 1 year, 11 months, 30 days and 23 hours.
So I'd really be interested why you think it doesn't "provide the data
correctly"
------------------------------------------------------------------------
[2017-06-04 08:12:47] karpulix at ya dot ru
But in fact diff does not provide the data correctly. Maybe need to fix the problem at the level of
the environment?
-----------
Ðо ÑакÑиÑеÑки diff
пÑедоÑÑавлÑÐµÑ Ð½ÐµÐ²ÐµÑнÑе
даннÑе. ÐÐ¾Ð¶ÐµÑ Ð±ÑÑÑ Ð½Ñжно
иÑпÑавлÑÑÑ Ð¿ÑÐ¾Ð±Ð»ÐµÐ¼Ñ Ð½Ð°
ÑÑовне окÑÑжениÑ?
------------------------------------------------------------------------
[2017-06-04 07:53:29] heiglandreas@php.net
The diff method works pretty well, you are only looking at a fraction of the result though.
When you look at https://3v4l.org/6eiD6 you will notice that
the difference is 1 year, 11 months, 30 days and 23 hours. Due to the DST-change it's 1 hour
short of being two years!
------------------------------------------------------------------------
[2017-06-02 12:14:36] karpulix at ya dot ru
Because of this, the method works incorrectly "diff" from "DateTime class"
-----
Ðз-за ÑÑого невеÑно ÑабоÑаеÑ
меÑод "diff" клаÑÑа DateTime
//correct:
$dataTimeZone = new DateTimeZone("Europe/Moscow");
$datetime = new DateTime('02.06.2015',$dataTimeZone);
$now = new DateTime('02.06.2017',$dataTimeZone);
$interval = $datetime->diff($now);
$fullYear = (int)$interval->format("%Y");
echo $fullYear;
// 2 - its correct
//incorrect
$dataTimeZone = new DateTimeZone("Asia/Novosibirsk");
$datetime = new DateTime('02.06.2015',$dataTimeZone);
$now = new DateTime('02.06.2017',$dataTimeZone);
$interval = $datetime->diff($now);
$fullYear = (int)$interval->format("%Y");
echo $fullYear;
// 1 - its incorrect
------------------------------------------------------------------------
[2017-06-02 11:33:26] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Actually, I see what happens.
There is no bug.
Unlike Moscow and New_York, Novosibirsk changed GMT offsets between June 2nd,2015 and June 2nd,
2017.
Moscow:
Europe/Moscow Sat Mar 26 23:00:00 2011 UT = Sun Mar 27 03:00:00 2011 MSK isdst=0 gmtoff=14400
Europe/Moscow Sat Oct 25 21:59:59 2014 UT = Sun Oct 26 01:59:59 2014 MSK isdst=0 gmtoff=14400
Europe/Moscow Sat Oct 25 22:00:00 2014 UT = Sun Oct 26 01:00:00 2014 MSK isdst=0 gmtoff=10800
(Last change was in 2014 to UTC+3)
New York
UTC+3
Novosibirsk:
Asia/Novosibirsk Sat Mar 26 20:00:00 2011 UT = Sun Mar 27 03:00:00 2011 +07 isdst=0 gmtoff=25200
Asia/Novosibirsk Sat Oct 25 18:59:59 2014 UT = Sun Oct 26 01:59:59 2014 +07 isdst=0 gmtoff=25200
Asia/Novosibirsk Sat Oct 25 19:00:00 2014 UT = Sun Oct 26 01:00:00 2014 +06 isdst=0 gmtoff=21600
Asia/Novosibirsk Sat Jul 23 19:59:59 2016 UT = Sun Jul 24 01:59:59 2016 +06 isdst=0 gmtoff=21600
Asia/Novosibirsk Sat Jul 23 20:00:00 2016 UT = Sun Jul 24 03:00:00 2016 +07 isdst=0 gmtoff=25200
UTC+6 in 2015, and UTC+7 in 2017. That's why you get the 3600 seconds difference.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=74691
--
Edit this bug report at https://bugs.php.net/bug.php?id=74691&edit=1