3v4l.org

run code in 200+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/Oslo'); $datetime = new DateTime(); echo $datetime->format('Y-m-d H:i:s.u')."\n"; $datetime = new DateTime('2016-08-07T11:59:12.345'); echo $datetime->format('Y-m-d H:i:s.u')."\n";
based on R3G9h
Output for 7.2.6
2016-08-07 11:59:51.002272 2016-08-07 11:59:12.345000
Output for 7.2.0
2016-08-07 11:59:51.003645 2016-08-07 11:59:12.345000
Output for 7.1.20
2016-08-07 11:59:51.002860 2016-08-07 11:59:12.345000
Output for 7.1.10
2016-08-07 11:59:51.003930 2016-08-07 11:59:12.345000
Output for 7.1.7
2016-08-07 11:59:51.005203 2016-08-07 11:59:12.345000
Output for 7.1.6
2016-08-07 11:59:51.005524 2016-08-07 11:59:12.345000
Output for 7.1.5
2016-08-07 11:59:51.012746 2016-08-07 11:59:12.345000
Output for 7.1.0
2016-08-07 11:59:51.003989 2016-08-07 11:59:12.345000
Output for 5.6.0 - 7.0.20
2016-08-07 11:59:51.000000 2016-08-07 11:59:12.345000