3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2013-09-05 23:00:00'); $interval = $datetime1->diff($datetime2); $elapsed = $interval->format('%y years, %m months, %d days, %h hours, %i minutes, %S seconds'); echo $elapsed;
based on bJb2j
Output for 7.0.14 - 7.1.0
1 years, 0 months, 0 days, 17 hours, 56 minutes, 52 seconds
Output for 7.0.6
2 years, 7 months, 27 days, 10 hours, 51 minutes, 01 seconds
Output for 7.0.5
2 years, 6 months, 26 days, 23 hours, 41 minutes, 56 seconds
Output for 7.0.4
2 years, 6 months, 4 days, 10 hours, 15 minutes, 06 seconds
Output for 7.0.3
2 years, 6 months, 12 days, 10 hours, 52 minutes, 46 seconds
Output for 7.0.2
2 years, 6 months, 16 days, 16 hours, 46 minutes, 27 seconds
Output for 7.0.1
2 years, 6 months, 17 days, 21 hours, 30 minutes, 49 seconds
Output for 7.0.0
2 years, 6 months, 21 days, -1 hours, 3 minutes, 34 seconds
Output for hhvm-3.12.0
2 years, 6 months, 6 days, -1 hours, 24 minutes, 54 seconds
Output for hhvm-3.10.0
2 years, 6 months, 24 days, 12 hours, 24 minutes, 32 seconds
Output for 5.6.21
2 years, 7 months, 26 days, 6 hours, 11 minutes, 57 seconds
Output for 5.6.20
2 years, 7 months, 3 days, 22 hours, 38 minutes, 47 seconds
Output for 5.6.19
2 years, 6 months, 1 days, 18 hours, 23 minutes, 05 seconds
Output for 5.6.18
2 years, 6 months, 9 days, 2 hours, 19 minutes, 26 seconds
Output for 5.6.17
2 years, 6 months, 13 days, 15 hours, 7 minutes, 51 seconds
Output for 5.6.16
2 years, 6 months, 22 days, 0 hours, 48 minutes, 44 seconds
Output for 5.6.15
2 years, 6 months, 23 days, 1 hours, 53 minutes, 57 seconds
Output for 5.6.14
2 years, 6 months, 26 days, 4 hours, 14 minutes, 46 seconds
Output for 5.6.13
2 years, 7 months, 9 days, 8 hours, 9 minutes, 27 seconds
Output for 5.6.12
2 years, 7 months, 13 days, 21 hours, 53 minutes, 58 seconds
Output for 5.6.11
2 years, 7 months, 17 days, 4 hours, 58 minutes, 01 seconds
Output for 5.6.10
2 years, 7 months, 19 days, 6 hours, 41 minutes, 49 seconds
Output for 5.6.9
2 years, 7 months, 21 days, 11 hours, 39 minutes, 36 seconds
Output for 5.6.8
2 years, 7 months, 23 days, 19 hours, 44 minutes, 48 seconds
Output for 5.5.35
2 years, 8 months, 16 days, 9 hours, 54 minutes, 49 seconds
Output for 5.5.34
2 years, 7 months, 5 days, 0 hours, 58 minutes, 59 seconds
Output for 5.5.33
2 years, 6 months, 2 days, 21 hours, 20 minutes, 00 seconds
Output for 5.5.32
2 years, 6 months, 11 days, 4 hours, 0 minutes, 43 seconds
Output for 5.5.31
2 years, 6 months, 14 days, 17 hours, 53 minutes, 42 seconds
Output for 5.5.30
2 years, 6 months, 25 days, 3 hours, 49 minutes, 40 seconds
Output for 5.5.29
2 years, 7 months, 10 days, 22 hours, 14 minutes, 41 seconds
Output for 5.5.28
2 years, 7 months, 15 days, 0 hours, 59 minutes, 06 seconds
Output for 5.5.27
2 years, 7 months, 16 days, 3 hours, 28 minutes, 49 seconds
Output for 5.5.26
2 years, 7 months, 20 days, 9 hours, 8 minutes, 46 seconds
Output for 5.5.25
2 years, 7 months, 22 days, 15 hours, 26 minutes, 42 seconds
Output for 5.5.24
2 years, 8 months, 17 days, 22 hours, 48 minutes, 03 seconds
Output for 5.4.45
2 years, 0 months, 15 days, 14 hours, 16 minutes, 43 seconds
Output for 5.4.44
2 years, 0 months, 15 days, 14 hours, 16 minutes, 39 seconds
Output for 5.4.43
2 years, 0 months, 15 days, 14 hours, 16 minutes, 33 seconds
Output for 5.4.42
2 years, 0 months, 15 days, 14 hours, 16 minutes, 30 seconds
Output for 5.4.41
2 years, 0 months, 15 days, 14 hours, 16 minutes, 27 seconds
Output for 5.4.40
2 years, 0 months, 15 days, 14 hours, 16 minutes, 23 seconds
Output for 5.4.39
2 years, 0 months, 15 days, 14 hours, 16 minutes, 20 seconds
Output for 5.4.38
1 years, 6 months, 7 days, 21 hours, 0 minutes, 01 seconds
Output for 5.4.37
1 years, 6 months, 7 days, 20 hours, 59 minutes, 52 seconds
Output for 5.4.35 - 5.4.36
1 years, 6 months, 7 days, 20 hours, 59 minutes, 51 seconds
Output for 5.4.34
1 years, 6 months, 7 days, 20 hours, 59 minutes, 50 seconds
Output for 5.4.23 - 5.4.32
1 years, 0 months, 0 days, 17 hours, 56 minutes, 56 seconds
Output for 5.4.1 - 5.4.22
1 years, 0 months, 0 days, 17 hours, 56 minutes, 57 seconds
Output for 5.3.10 - 5.4.0
1 years, 0 months, 0 days, 17 hours, 56 minutes, 58 seconds
Output for 5.3.0 - 5.3.9
1 years, 0 months, 0 days, 17 hours, 56 minutes, 59 seconds
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/sAgph on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/sAgph 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/sAgph 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/sAgph on line 2