3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "datetime: " . date('Y-m-d H:i:s') . "\n"; echo "time: " . time() . "\n"; $date = DateTime::createFromFormat('Y-m-d H:i:s', '2016-01-07 22:28:34'); echo "datetime with offset: " . date('Y-m-d H:i:s', $date->format('U') + 32400) . "\n"; echo "date now: " . date('Y-m-d H:i:s')->format(\DateTime::RFC2822);;
based on 6jaJg
Output for 7.0.0 - 7.2.0
datetime: 2016-01-07 22:32:34 time: 1452202354 datetime with offset: 2016-01-08 07:28:34 Fatal error: Uncaught Error: Call to a member function format() on string in /in/hMcht:6 Stack trace: #0 {main} thrown in /in/hMcht on line 6
Process exited with code 255.
Output for 5.6.0 - 5.6.25
datetime: 2016-01-07 22:32:34 time: 1452202354 datetime with offset: 2016-01-08 07:28:34 Fatal error: Call to a member function format() on string in /in/hMcht on line 6
Process exited with code 255.
Output for 5.5.0 - 5.5.38
datetime: 2016-01-07 22:32:34 time: 1452202354 datetime with offset: 2016-01-08 07:28:34 Fatal error: Call to a member function format() on a non-object in /in/hMcht on line 6
Process exited with code 255.