Jaxel
Well-known member
Assuming
You would think this would output the first of the month, and the last of the month.
Instead its outputting both values as the last of the month. What am I doing wrong?
2018
, 01
...
Code:
$visitor = \XF::visitor();
$strTime = new \DateTime('now', new \DateTimeZone($visitor->timezone));
$strTime->setDate($params->year, $params->month, 1);
$strTime->setTime(0,0,0);
$endTime = $strTime;
$endTime->modify('+1 month -1 day');
\XF::dump($strTime->format('r'));
\XF::dump($endTime->format('r'));
You would think this would output the first of the month, and the last of the month.
Instead its outputting both values as the last of the month. What am I doing wrong?