note 123420 added to class.datetime

From: Date: Tue, 11 Dec 2018 15:55:24 +0000
Subject: note 123420 added to class.datetime
Groups: php.notes 
Request: Send a blank email to php-notes+get-209873@lists.php.net to get a copy of this message
You should take care using this function. For exemple : $curr_date = new DateTime('2018-12-31'); $day = $curr_date->format("N"); $week_d = $curr_date->format("W"); $year = $curr_date->format("Y"); $day = 31 Nothing strange here. $week_d = 1 Once again : the week is well write $year = 2018 Here is the problem. Yes, technically 12/31 is still 2018. But going with week, you could get the first week of 2018 rather than the first week of 2019! ---- Server IP: 208.43.231.9 Probable Submitter: 92.103.54.182 ---- Manual Page -- http://php.net/manual/en/class.datetime.php Edit -- https://master.php.net/note/edit/123420 Del: integrated -- https://master.php.net/note/delete/123420/integrated Del: useless -- https://master.php.net/note/delete/123420/useless Del: bad code -- https://master.php.net/note/delete/123420/bad+code Del: spam -- https://master.php.net/note/delete/123420/spam Del: non-english -- https://master.php.net/note/delete/123420/non-english Del: in docs -- https://master.php.net/note/delete/123420/in+docs Del: other reasons-- https://master.php.net/note/delete/123420 Reject -- https://master.php.net/note/reject/123420 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209873) next »