php - setISODate work that way? -
i testing these cases:
$date = new \datetime(); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2018, 1, 1); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2019, 1, 1); echo($date->format('y.m.d')) . php_eol; $date->setisodate(2020, 1, 1); echo($date->format('y.m.d')) . php_eol;
ouput:
2017.08.17 2018.01.01 2018.12.31 2019.12.30
i understood show this:
2017.08.17 2018.01.01 2019.01.01 2020.01.01
why happen?
surely there did not quite understand.
the arguments year
, week
, dayofweek
. php's week starts on monday, , week 1 of year first week has @ least 4 days in january.
in 2018, year starts on monday, week 1 starts on january 1, , that's day 1 of week.
in 2019, year starts on tuesday, week 1 starts on monday, december 31, 2018, , that's day 1 of week.
in 2020, year starts on wednesday, week 1 starts on monday, december 30, 2019, that's day 1 of week.
Comments
Post a Comment