<?php
$date1 = new \DateTime('first day of this month');
echo $date1->format('Y-m-d') . "\n";
$date1->setDate(2016, 1, 8);
echo $date1->format('Y-m-d') . "\n";
$date2 = new \DateTime('first day of january');
echo $date2->format('Y-m-d') . "\n";
$date2->setDate(2016, 3, 8);
echo $date2->format('Y-m-d') . "\n";
- Output for 7.0.17 - 7.0.33, 7.1.3 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- 2017-03-01
2016-01-08
2017-01-01
2016-03-08
- Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.16, 7.1.0 - 7.1.2
- 2017-03-01
2016-01-01
2017-01-01
2016-03-01
preferences:
141.17 ms | 407 KiB | 5 Q