note 119974 added to function.date

From: Date: Sat, 01 Oct 2016 14:16:49 +0000
Subject: note 119974 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-206715@lists.php.net to get a copy of this message
Prior to PHP 5.6.23, Relative Formats for the start of the week aligned with PHP's (0=Sunday,6=Saturday). Since 5.6.23, Relative Formats for the start of the week align with ISO-8601 (1=Monday,7=Sunday). (http://php.net/manual/en/datetime.formats.relative.php) This can produce different, and seemingly incorrect, results depending on your PHP version and your choice of 'w' or 'N' for the Numeric representation of the day of the week: <?php echo "Today is Sun 2 Oct 2016, day ",date('w',strtotime('2016-10-02'))," of this week. "; echo "Day ",date('w',strtotime('2016-10-02 Monday next week'))," of next week is ",date('d M Y',strtotime('2016-10-02 Monday next week')),"<br />"; echo "Today is Sun 2 Oct 2016, day ",date('N',strtotime('2016-10-02'))," of this week. "; echo "Day ",date('w',strtotime('2016-10-02 Monday next week'))," of next week is ",date('d M Y',strtotime('2016-10-02 Monday next week')); ?> Prior to PHP 5.6.23, this results in: Today is Sun 2 Oct 2016, day 0 of this week. Day 1 of next week is 10 Oct 2016 Today is Sun 2 Oct 2016, day 7 of this week. Day 1 of next week is 10 Oct 2016 Since PHP 5.6.23, this results in: Today is Sun 2 Oct 2016, day 0 of this week. Day 1 of next week is 03 Oct 2016 Today is Sun 2 Oct 2016, day 7 of this week. Day 1 of next week is 03 Oct 2016 ---- Server IP: 72.52.91.14 Probable Submitter: 210.1.207.223 ---- Manual Page -- http://php.net/manual/en/function.date.php Edit -- https://master.php.net/note/edit/119974 Del: integrated -- https://master.php.net/note/delete/119974/integrated Del: useless -- https://master.php.net/note/delete/119974/useless Del: bad code -- https://master.php.net/note/delete/119974/bad+code Del: spam -- https://master.php.net/note/delete/119974/spam Del: non-english -- https://master.php.net/note/delete/119974/non-english Del: in docs -- https://master.php.net/note/delete/119974/in+docs Del: other reasons-- https://master.php.net/note/delete/119974 Reject -- https://master.php.net/note/reject/119974 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206715) next »