3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2013-01-03 17:13:00'); echo "<pre>"; print_r($datetime1); // $interval = $datetime1->diff($datetime2); //$interval = $datetime2 - $datetime1; //$elapsed = $interval->format('%y years, %m months, %a days, %h hours, %i minutes, %S seconds'); //echo $elapsed;
Output for 7.1.0
<pre>DateTime Object ( [date] => 2013-05-08 13:22:27.005595 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.12 - 7.0.14
<pre>DateTime Object ( [date] => 2013-05-08 13:22:27.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.6
<pre>DateTime Object ( [date] => 2016-05-03 18:10:13.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.5
<pre>DateTime Object ( [date] => 2016-04-03 06:36:36.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.4
<pre>DateTime Object ( [date] => 2016-03-10 18:22:15.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.3
<pre>DateTime Object ( [date] => 2016-03-18 19:27:49.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.2
<pre>DateTime Object ( [date] => 2016-03-23 01:35:49.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.1
<pre>DateTime Object ( [date] => 2016-03-24 05:18:04.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 7.0.0
<pre>DateTime Object ( [date] => 2016-03-27 07:14:32.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.21
<pre>DateTime Object ( [date] => 2016-05-02 13:19:57.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.20
<pre>DateTime Object ( [date] => 2016-04-10 05:35:51.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.19
<pre>DateTime Object ( [date] => 2016-03-08 02:32:47.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.18
<pre>DateTime Object ( [date] => 2016-03-15 11:15:35.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.17
<pre>DateTime Object ( [date] => 2016-03-19 22:55:33.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.16
<pre>DateTime Object ( [date] => 2016-03-28 08:01:39.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.15
<pre>DateTime Object ( [date] => 2016-03-29 08:52:24.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.14
<pre>DateTime Object ( [date] => 2016-04-02 10:44:48.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.13
<pre>DateTime Object ( [date] => 2016-04-15 15:07:07.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.12
<pre>DateTime Object ( [date] => 2016-04-20 05:35:57.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.11
<pre>DateTime Object ( [date] => 2016-04-24 11:51:51.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.10
<pre>DateTime Object ( [date] => 2016-04-25 14:00:54.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.9
<pre>DateTime Object ( [date] => 2016-04-27 19:11:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.6.8
<pre>DateTime Object ( [date] => 2016-04-30 04:04:08.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.35
<pre>DateTime Object ( [date] => 2016-05-22 19:47:43.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.34
<pre>DateTime Object ( [date] => 2016-04-11 07:47:41.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.33
<pre>DateTime Object ( [date] => 2016-03-09 05:12:27.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.32
<pre>DateTime Object ( [date] => 2016-03-17 14:55:15.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.31
<pre>DateTime Object ( [date] => 2016-03-21 01:55:18.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.30
<pre>DateTime Object ( [date] => 2016-04-01 10:46:06.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.29
<pre>DateTime Object ( [date] => 2016-04-17 05:30:47.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.28
<pre>DateTime Object ( [date] => 2016-04-21 08:49:16.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.27
<pre>DateTime Object ( [date] => 2016-04-22 10:37:05.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.26
<pre>DateTime Object ( [date] => 2016-04-26 16:44:17.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.25
<pre>DateTime Object ( [date] => 2016-04-28 23:35:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.5.24
<pre>DateTime Object ( [date] => 2016-05-24 06:09:34.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.44 - 5.4.45
<pre>DateTime Object ( [date] => 2015-11-03 11:12:59.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.37 - 5.4.43
<pre>DateTime Object ( [date] => 2015-11-03 11:13:00.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.30 - 5.4.36
<pre>DateTime Object ( [date] => 2015-11-03 11:13:01.000000 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.29
<pre>DateTime Object ( [date] => 2015-11-03 11:13:01 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.19 - 5.4.28
<pre>DateTime Object ( [date] => 2015-11-03 11:13:02 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.4.9 - 5.4.18
<pre>DateTime Object ( [date] => 2015-11-03 11:13:03 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.29 - 5.4.8
<pre>DateTime Object ( [date] => 2015-11-03 11:13:04 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.19 - 5.3.28
<pre>DateTime Object ( [date] => 2015-11-03 11:13:05 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.9 - 5.3.18
<pre>DateTime Object ( [date] => 2015-11-03 11:13:06 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.3.0 - 5.3.8
<pre>DateTime Object ( [date] => 2015-11-03 11:13:07 [timezone_type] => 3 [timezone] => Europe/Amsterdam )
Output for 5.2.0 - 5.2.17
<pre>DateTime Object ( )
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/naBhr on line 2
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/naBhr on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/naBhr on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/naBhr on line 2