3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @link https://stackoverflow.com/a/13129856/367456 */ $formats = array( 'today midnight', 'midnight', 'today', 'TODAY', 'MidNight', 'ToDaY', 'tomorrow', 'UTC today', 'today Z', 'today Europe/Berlin', 'Asia/Shanghai today', 'Asia/Shanghai', 'HKST today', ); $time = strtotime('UTC 2020-01-01 00:00:00'); printf("UTC time is: %d (script-time, is UTC 2020-01-01 00:00:00)\n", $time); if (is_callable('date_default_timezone_get')) { printf("default time-zone is: %s\n", date_default_timezone_get()); } else { printf("default time-zone is: %s\n", '???'); } foreach ($formats as $format) { printf("%'.-24s: %s\n", "$format ", strtotime($format, $time)); }

preferences:
62.31 ms | 411 KiB | 5 Q