3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2014-09-07 17:13:00'); $interval = $datetime1->diff($datetime2); $elapsed = $interval->format('%y years, %m months, %d days, %h hours, %i minutes, %S seconds'); echo $elapsed;
based on 5eN9Q
Output for 5.6.28, 7.0.14 - 7.1.0
0 years, 0 months, 7 days, 17 hours, 32 minutes, 25 seconds
Output for 7.0.6
1 years, 7 months, 25 days, 14 hours, 50 minutes, 18 seconds
Output for 7.0.5
1 years, 6 months, 25 days, 3 hours, 47 minutes, 25 seconds
Output for 7.0.4
1 years, 6 months, 2 days, 14 hours, 3 minutes, 38 seconds
Output for 7.0.3
1 years, 6 months, 10 days, 14 hours, 35 minutes, 45 seconds
Output for 7.0.2
1 years, 6 months, 14 days, 20 hours, 20 minutes, 59 seconds
Output for 7.0.1
1 years, 6 months, 16 days, 1 hours, 22 minutes, 47 seconds
Output for 7.0.0
1 years, 6 months, 19 days, 3 hours, 3 minutes, 19 seconds
Output for hhvm-3.12.0
1 years, 6 months, 19 days, 0 hours, 55 minutes, 51 seconds
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.21
1 years, 7 months, 24 days, 10 hours, 9 minutes, 33 seconds
Output for 5.6.20
1 years, 7 months, 2 days, 2 hours, 37 minutes, 21 seconds
Output for 5.6.19
1 years, 5 months, 29 days, 22 hours, 9 minutes, 31 seconds
Output for 5.6.18
1 years, 6 months, 7 days, 5 hours, 54 minutes, 55 seconds
Output for 5.6.17
1 years, 6 months, 11 days, 18 hours, 54 minutes, 08 seconds
Output for 5.6.16
1 years, 6 months, 20 days, 4 hours, 48 minutes, 38 seconds
Output for 5.6.15
1 years, 6 months, 21 days, 5 hours, 41 minutes, 47 seconds
Output for 5.6.14
1 years, 6 months, 24 days, 8 hours, 16 minutes, 06 seconds
Output for 5.6.13
1 years, 7 months, 7 days, 12 hours, 11 minutes, 34 seconds
Output for 5.6.12
1 years, 7 months, 12 days, 1 hours, 47 minutes, 42 seconds
Output for 5.6.11
1 years, 7 months, 15 days, 8 hours, 46 minutes, 57 seconds
Output for 5.6.10
1 years, 7 months, 17 days, 10 hours, 38 minutes, 12 seconds
Output for 5.6.9
1 years, 7 months, 19 days, 15 hours, 35 minutes, 32 seconds
Output for 5.6.8
1 years, 7 months, 21 days, 23 hours, 35 minutes, 54 seconds
Output for 5.6.7
1 years, 8 months, 17 days, 17 hours, 43 minutes, 14 seconds
Output for 5.5.35
1 years, 8 months, 14 days, 13 hours, 51 minutes, 02 seconds
Output for 5.5.34
1 years, 7 months, 3 days, 5 hours, 3 minutes, 51 seconds
Output for 5.5.33
1 years, 6 months, 1 days, 0 hours, 59 minutes, 23 seconds
Output for 5.5.32
1 years, 6 months, 9 days, 7 hours, 46 minutes, 34 seconds
Output for 5.5.31
1 years, 6 months, 12 days, 21 hours, 41 minutes, 20 seconds
Output for 5.5.30
1 years, 6 months, 24 days, 7 hours, 50 minutes, 06 seconds
Output for 5.5.29
1 years, 7 months, 9 days, 2 hours, 16 minutes, 32 seconds
Output for 5.5.28
1 years, 7 months, 13 days, 4 hours, 53 minutes, 46 seconds
Output for 5.5.27
1 years, 7 months, 14 days, 7 hours, 24 minutes, 15 seconds
Output for 5.5.26
1 years, 7 months, 18 days, 13 hours, 4 minutes, 04 seconds
Output for 5.5.25
1 years, 7 months, 20 days, 19 hours, 7 minutes, 21 seconds
Output for 5.5.24
1 years, 8 months, 16 days, 2 hours, 2 minutes, 37 seconds
Output for 5.4.45
1 years, 0 months, 13 days, 20 hours, 30 minutes, 46 seconds
Output for 5.4.44
1 years, 0 months, 13 days, 20 hours, 30 minutes, 38 seconds
Output for 5.4.43
1 years, 0 months, 13 days, 20 hours, 30 minutes, 23 seconds
Output for 5.4.42
1 years, 0 months, 13 days, 20 hours, 30 minutes, 16 seconds
Output for 5.4.41
1 years, 0 months, 13 days, 20 hours, 30 minutes, 07 seconds
Output for 5.4.40
1 years, 0 months, 13 days, 20 hours, 29 minutes, 58 seconds
Output for 5.4.39
1 years, 0 months, 13 days, 20 hours, 29 minutes, 51 seconds
Output for 5.4.38
0 years, 6 months, 7 days, 0 hours, 54 minutes, 11 seconds
Output for 5.4.37
0 years, 6 months, 7 days, 0 hours, 54 minutes, 03 seconds
Output for 5.4.35 - 5.4.36
0 years, 6 months, 7 days, 0 hours, 54 minutes, 02 seconds
Output for 5.4.34
0 years, 6 months, 7 days, 0 hours, 54 minutes, 01 seconds
Output for 5.4.16 - 5.4.32
0 years, 0 months, 7 days, 17 hours, 32 minutes, 29 seconds
Output for 5.3.24 - 5.4.15
0 years, 0 months, 7 days, 17 hours, 32 minutes, 30 seconds
Output for 5.3.3 - 5.3.23
0 years, 0 months, 7 days, 17 hours, 32 minutes, 31 seconds
Output for 5.3.0 - 5.3.2
0 years, 0 months, 7 days, 17 hours, 32 minutes, 32 seconds
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/EQjm5 on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/EQjm5 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/EQjm5 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/EQjm5 on line 2