3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $needYear=2018; $needMonth=10; // $_startTime = strtotime('2018-10-31 00:00:00'); // $_endTime = strtotime('2018-11-01 00:00:00'); // var_dump(date('Y-n', $_startTime), date('Y-n', $_endTime), $needYear . '-' . $needMonth); var_dump(date('Y-m-d', strtotime('last day of 2018-10'))); var_dump(date('Y-m-d', strtotime('2018-10 last day'))); var_dump(date('Y-m-d', strtotime('first day of 2018-10'))); var_dump(date('Y-m-d', strtotime('2018-10 first day')));
based on FbeHv
Output for 5.6.38 - 7.3.0rc3
string(10) "2018-10-31" string(10) "2018-09-30" string(10) "2018-10-01" string(10) "2018-10-02"