@ 2014-07-10T09:04:02Z <?php
$startDate = new DateTime('2014-05-01');
$endDate = new DateTime('2014-06-02');
// calculate diff
$diff = $startDate->diff($endDate);
$daysDiff = $diff->days;
for ($i = 0; $i < $daysDiff; $i++) {
// clone so the original date will not be changed
$currentDate = clone $startDate;
$currentDate->modify('+'.$i.' days');
echo $currentDate->format('Y-m-d H:i:s')."\n";
}
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.40 , 7.0.0 - 7.0.33 , 7.1.0 - 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.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 2014-05-01 00:00:00
2014-05-02 00:00:00
2014-05-03 00:00:00
2014-05-04 00:00:00
2014-05-05 00:00:00
2014-05-06 00:00:00
2014-05-07 00:00:00
2014-05-08 00:00:00
2014-05-09 00:00:00
2014-05-10 00:00:00
2014-05-11 00:00:00
2014-05-12 00:00:00
2014-05-13 00:00:00
2014-05-14 00:00:00
2014-05-15 00:00:00
2014-05-16 00:00:00
2014-05-17 00:00:00
2014-05-18 00:00:00
2014-05-19 00:00:00
2014-05-20 00:00:00
2014-05-21 00:00:00
2014-05-22 00:00:00
2014-05-23 00:00:00
2014-05-24 00:00:00
2014-05-25 00:00:00
2014-05-26 00:00:00
2014-05-27 00:00:00
2014-05-28 00:00:00
2014-05-29 00:00:00
2014-05-30 00:00:00
2014-05-31 00:00:00
2014-06-01 00:00:00
Output for 5.2.0 - 5.2.17 Fatal error: Call to undefined method DateTime::diff() in /in/RmNGq on line 5
Process exited with code 255 . Output for 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 Fatal error: Class 'DateTime' not found in /in/RmNGq on line 2
Process exited with code 255 . Output for 4.4.2 - 4.4.9 Parse error: syntax error, unexpected T_VARIABLE in /in/RmNGq on line 11
Process exited with code 255 . Output for 4.3.0 - 4.3.1 , 4.3.5 - 4.3.11 , 4.4.0 - 4.4.1 Parse error: parse error, unexpected T_VARIABLE in /in/RmNGq on line 11
Process exited with code 255 . Output for 4.3.2 - 4.3.4 Parse error: parse error in /in/RmNGq on line 11
Process exited with code 255 . preferences:dark mode live preview
321.77 ms | 401 KiB | 456 Q