note 123420 rejected from class.datetime by cmb
| From: | cmb@php.net | Date: | Tue, 11 Dec 2018 18:29:53 +0000 |
| Subject: | note 123420 rejected from class.datetime by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209877@lists.php.net to get a copy of this message | ||
Note Submitter: t dot grockowiak at spartoo dot com
----
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!