3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (function_exists('date_default_timezone_set')) date_default_timezone_set("UTC"); echo "works as expected:\n"; echo date("Y-m-d H:i:s", strtotime("2019W14")) . " should be 2019-04-01\n"; echo date("Y-m-d H:i:s", strtotime("2019W15")) . " should be 2019-04-08\n"; echo date("Y-m-d H:i:s", strtotime("2019W16")) . " should be 2019-04-15\n\n"; echo "off by one:\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next tuesday")) . " should be 2019-04-16\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next wednesday")) . " should be 2019-04-17\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next thursday")) . " should be 2019-04-18\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next friday")) . " should be 2019-04-19\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next saturday")) . " should be 2019-04-20\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next sunday")) . " should be 2019-04-21\n"; echo date("Y-m-d H:i:s", strtotime("2019W16 next monday")) . " should be 2019-04-22\n\n"; echo "works as expected:\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next monday")) . " should be 2019-04-22\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next friday")) . " should be 2019-04-19\n"; echo date("Y-m-d H:i:s", strtotime("2019-04-15 next thursday")) . " should be 2019-04-18\n";

preferences:
67.56 ms | 402 KiB | 5 Q