3v4l.org

run code in 300+ PHP versions simultaneously
<?php $d = 1450283411; echo "Midnight of $d\n"; $date = new DateTime(); $date->setTimestamp($d); $date->setTime(0,0,0); echo $date->format('Y-m-d, H:i:s'); echo "\nor\n"; echo date(floor($d/86400)*86400,'Y-m-d H:i:s');
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Midnight of 1450283411 2015-12-16, 00:00:00 or Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, string given in /in/QCfLP:11 Stack trace: #0 /in/QCfLP(11): date('1450224000', 'Y-m-d H:i:s') #1 {main} thrown in /in/QCfLP on line 11
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Midnight of 1450283411 2015-12-16, 00:00:00 or Warning: date() expects parameter 2 to be int, string given in /in/QCfLP on line 11
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.6 - 7.2.33
Midnight of 1450283411 2015-12-16, 00:00:00 or Warning: date() expects parameter 2 to be integer, string given in /in/QCfLP on line 11
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.28
Midnight of 1450283411 2015-12-16, 00:00:00 or Warning: date() expects parameter 2 to be long, string given in /in/QCfLP on line 11

preferences:
174.29 ms | 402 KiB | 254 Q