|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-11-25 06:39 UTC] 8f181bd2 at opayq dot com
-: chanceofwonder at gmx dot com
+: 8f181bd2 at opayq dot com
-Summary: Weekday calculated incorrectly using $weekDay =
date('N', strtotime($date));
+Summary: Exact PHP version
[2014-11-25 06:39 UTC] 8f181bd2 at opayq dot com
[2014-11-25 06:40 UTC] 8f181bd2 at opayq dot com
-Summary: Exact PHP version
+Summary: Weekday calculated incorrectly using $weekDay =
date('N', strtotime($date));
[2014-11-25 06:40 UTC] 8f181bd2 at opayq dot com
[2014-11-25 08:36 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2014-11-25 08:36 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 22 05:00:01 2025 UTC |
Description: ------------ Weekday calculated incorrectly for dates in the far future, using $weekDay = date('N', strtotime($date)); Test script: --------------- function getWeekday($date) { $dateTime = \DateTime::createFromFormat('m/d/Y', $date); $date = date_format($dateTime, 'm/d/Y'); $weekDay = date('N', strtotime($date)); return $weekDay; } $arr = ['01/04/2050' => 'Sun', '01/09/2050' => 'Tues', '07/04/2050' => 'Mon', '04/06/2014' => 'Sun', '10/22/2014' => 'Wed', '10/25/2014' => 'Sat', '11/23/2014' => 'Sun']; foreach($arr as $date => $shouldBe) { echo $date.' is on weekday '.getWeekday($date).' - This should be '.$shouldBe.'<br/>'; } Expected result: ---------------- 01/04/2050 is on weekday 0 - This should be Sun 01/09/2050 is on weekday 2 - This should be Tues 07/04/2050 is on weekday 1 - This should be Mon 04/06/2014 is on weekday 7 - This should be Sun 10/22/2014 is on weekday 3 - This should be Wed 10/25/2014 is on weekday 6 - This should be Sat 11/23/2014 is on weekday 7 - This should be Sun Actual result: -------------- 01/04/2050 is on weekday 4 - This should be Sun 01/09/2050 is on weekday 4 - This should be Tues 07/04/2050 is on weekday 4 - This should be Mon 04/06/2014 is on weekday 7 - This should be Sun 10/22/2014 is on weekday 3 - This should be Wed 10/25/2014 is on weekday 6 - This should be Sat 11/23/2014 is on weekday 7 - This should be Sun