3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datetime1 = new DateTime(); $datetime2 = new DateTime('2013-01-03 17:13:00'); $interval = $datetime1->diff($datetime2); $elapsed = $interval->format('%y years %m months %a days %h hours %i minutes %S seconds'); echo $elapsed;
Output for 5.6.28, 7.0.12 - 7.1.0
0 years 3 months 117 days 7 hours 7 minutes 54 seconds
Output for 7.0.6
3 years 3 months 1215 days 12 hours 2 minutes 50 seconds
Output for 7.0.5
3 years 2 months 1185 days 1 hours 10 minutes 19 seconds
Output for 7.0.4
3 years 2 months 1161 days 11 hours 2 minutes 34 seconds
Output for 7.0.3
3 years 2 months 1169 days 11 hours 22 minutes 38 seconds
Output for 7.0.2
3 years 2 months 1172 days 21 hours 50 minutes 35 seconds
Output for 7.0.1
3 years 2 months 1174 days 22 hours 27 minutes 51 seconds
Output for 7.0.0
3 years 2 months 1178 days 0 hours 17 minutes 19 seconds
Output for 5.6.21
3 years 3 months 1214 days 7 hours 6 minutes 45 seconds
Output for 5.6.20
3 years 3 months 1191 days 20 hours 25 minutes 02 seconds
Output for 5.6.19
3 years 2 months 1158 days 10 hours 45 minutes 58 seconds
Output for 5.6.18
3 years 2 months 1166 days 0 hours 3 minutes 09 seconds
Output for 5.6.17
3 years 2 months 1170 days 15 hours 47 minutes 07 seconds
Output for 5.6.16
3 years 2 months 1179 days 2 hours 3 minutes 25 seconds
Output for 5.6.15
3 years 2 months 1180 days 2 hours 56 minutes 37 seconds
Output for 5.6.14
3 years 2 months 1184 days 5 hours 27 minutes 45 seconds
Output for 5.6.13
3 years 3 months 1197 days 9 hours 28 minutes 15 seconds
Output for 5.6.12
3 years 3 months 1201 days 22 hours 46 minutes 21 seconds
Output for 5.6.11
3 years 3 months 1205 days 5 hours 53 minutes 01 seconds
Output for 5.6.10
3 years 3 months 1207 days 7 hours 31 minutes 36 seconds
Output for 5.6.9
3 years 3 months 1209 days 12 hours 44 minutes 11 seconds
Output for 5.6.8
3 years 3 months 1211 days 20 hours 32 minutes 40 seconds
Output for 5.6.7
3 years 4 months 1237 days 9 hours 28 minutes 13 seconds
Output for 5.5.35
3 years 4 months 1234 days 10 hours 54 minutes 36 seconds
Output for 5.5.34
3 years 3 months 1193 days 2 hours 22 minutes 58 seconds
Output for 5.5.33
3 years 2 months 1159 days 21 hours 58 minutes 47 seconds
Output for 5.5.32
3 years 2 months 1168 days 3 hours 47 minutes 07 seconds
Output for 5.5.31
3 years 2 months 1171 days 18 hours 38 minutes 26 seconds
Output for 5.5.30
3 years 2 months 1183 days 4 hours 57 minutes 48 seconds
Output for 5.5.29
3 years 3 months 1198 days 23 hours 33 minutes 07 seconds
Output for 5.5.28
3 years 3 months 1203 days 1 hours 57 minutes 46 seconds
Output for 5.5.27
3 years 3 months 1204 days 4 hours 18 minutes 36 seconds
Output for 5.5.26
3 years 3 months 1208 days 10 hours 6 minutes 47 seconds
Output for 5.5.25
3 years 3 months 1210 days 16 hours 4 minutes 06 seconds
Output for 5.5.24
3 years 4 months 1235 days 22 hours 57 minutes 18 seconds
Output for 5.4.45
2 years 10 months 1051 days 20 hours 10 minutes 11 seconds
Output for 5.4.44
2 years 10 months 1051 days 20 hours 10 minutes 12 seconds
Output for 5.4.43
2 years 10 months 1051 days 20 hours 10 minutes 13 seconds
Output for 5.4.41 - 5.4.42
2 years 10 months 1051 days 20 hours 10 minutes 14 seconds
Output for 5.4.39 - 5.4.40
2 years 10 months 1051 days 20 hours 10 minutes 15 seconds
Output for 5.4.36 - 5.4.38
2 years 10 months 1051 days 20 hours 10 minutes 16 seconds
Output for 5.4.35
2 years 10 months 1051 days 20 hours 10 minutes 17 seconds
Output for 5.3.29, 5.4.31 - 5.4.34
2 years 10 months 1051 days 20 hours 10 minutes 18 seconds
Output for 5.4.28 - 5.4.30
2 years 10 months 1051 days 20 hours 10 minutes 19 seconds
Output for 5.4.25 - 5.4.27
2 years 10 months 1051 days 20 hours 10 minutes 20 seconds
Output for 5.3.28, 5.4.22 - 5.4.24
2 years 10 months 1051 days 20 hours 10 minutes 21 seconds
Output for 5.4.19 - 5.4.21
2 years 10 months 1051 days 20 hours 10 minutes 22 seconds
Output for 5.3.26 - 5.3.27, 5.4.16 - 5.4.18
2 years 10 months 1051 days 20 hours 10 minutes 23 seconds
Output for 5.3.23 - 5.3.25, 5.4.12 - 5.4.15
2 years 10 months 1051 days 20 hours 10 minutes 24 seconds
Output for 5.3.18 - 5.3.22, 5.4.9 - 5.4.11
2 years 10 months 1051 days 20 hours 10 minutes 25 seconds
Output for 5.3.15 - 5.3.17, 5.4.5 - 5.4.8
2 years 10 months 1051 days 20 hours 10 minutes 26 seconds
Output for 5.3.11 - 5.3.14, 5.4.2 - 5.4.4
2 years 10 months 1051 days 20 hours 10 minutes 27 seconds
Output for 5.3.6 - 5.3.10, 5.4.0 - 5.4.1
2 years 10 months 1051 days 20 hours 10 minutes 28 seconds
Output for 5.3.2 - 5.3.5
2 years 10 months 1051 days 20 hours 10 minutes 29 seconds
Output for 5.3.0 - 5.3.1
2 years 10 months 1051 days 20 hours 10 minutes 30 seconds
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/7UWMc on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/7UWMc 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/7UWMc 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/7UWMc on line 2