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, %d days, %h hours, %i minutes, %S seconds'); echo $elapsed;
Output for 5.6.28, 7.0.14 - 7.1.0
1 years, 11 months, 1 days, 23 hours, 9 minutes, 46 seconds
Output for 7.0.6
3 years, 3 months, 30 days, 13 hours, 34 minutes, 59 seconds
Output for 7.0.5
3 years, 2 months, 30 days, 2 hours, 35 minutes, 52 seconds
Output for 7.0.4
3 years, 2 months, 6 days, 12 hours, 42 minutes, 57 seconds
Output for 7.0.3
3 years, 2 months, 14 days, 13 hours, 9 minutes, 25 seconds
Output for 7.0.2
3 years, 2 months, 18 days, 18 hours, 40 minutes, 53 seconds
Output for 7.0.1
3 years, 2 months, 20 days, 0 hours, 5 minutes, 47 seconds
Output for 7.0.0
3 years, 2 months, 23 days, 1 hours, 48 minutes, 14 seconds
Output for 5.6.21
3 years, 3 months, 29 days, 8 hours, 51 minutes, 46 seconds
Output for 5.6.20
3 years, 3 months, 5 days, 21 hours, 52 minutes, 30 seconds
Output for 5.6.19
3 years, 2 months, 3 days, 13 hours, 41 minutes, 41 seconds
Output for 5.6.18
3 years, 2 months, 11 days, 2 hours, 40 minutes, 30 seconds
Output for 5.6.17
3 years, 2 months, 15 days, 17 hours, 30 minutes, 10 seconds
Output for 5.6.16
3 years, 2 months, 24 days, 3 hours, 33 minutes, 19 seconds
Output for 5.6.15
3 years, 2 months, 25 days, 4 hours, 25 minutes, 41 seconds
Output for 5.6.14
3 years, 2 months, 29 days, 6 hours, 54 minutes, 17 seconds
Output for 5.6.13
3 years, 3 months, 11 days, 10 hours, 58 minutes, 31 seconds
Output for 5.6.12
3 years, 3 months, 16 days, 0 hours, 29 minutes, 36 seconds
Output for 5.6.11
3 years, 3 months, 19 days, 7 hours, 27 minutes, 46 seconds
Output for 5.6.10
3 years, 3 months, 21 days, 9 hours, 19 minutes, 05 seconds
Output for 5.6.9
3 years, 3 months, 23 days, 14 hours, 17 minutes, 51 seconds
Output for 5.6.8
3 years, 3 months, 25 days, 22 hours, 11 minutes, 23 seconds
Output for 5.6.7
3 years, 4 months, 21 days, 13 hours, 53 minutes, 58 seconds
Output for 5.5.35
3 years, 4 months, 18 days, 12 hours, 29 minutes, 41 seconds
Output for 5.5.34
3 years, 3 months, 7 days, 3 hours, 50 minutes, 08 seconds
Output for 5.5.33
3 years, 2 months, 4 days, 23 hours, 36 minutes, 49 seconds
Output for 5.5.32
3 years, 2 months, 13 days, 5 hours, 39 minutes, 27 seconds
Output for 5.5.31
3 years, 2 months, 16 days, 20 hours, 18 minutes, 59 seconds
Output for 5.5.30
3 years, 2 months, 28 days, 6 hours, 25 minutes, 36 seconds
Output for 5.5.29
3 years, 3 months, 13 days, 1 hours, 3 minutes, 34 seconds
Output for 5.5.28
3 years, 3 months, 17 days, 3 hours, 33 minutes, 21 seconds
Output for 5.5.27
3 years, 3 months, 18 days, 6 hours, 0 minutes, 16 seconds
Output for 5.5.26
3 years, 3 months, 22 days, 11 hours, 44 minutes, 42 seconds
Output for 5.5.25
3 years, 3 months, 24 days, 17 hours, 47 minutes, 05 seconds
Output for 5.5.24
3 years, 4 months, 20 days, 0 hours, 42 minutes, 11 seconds
Output for 5.4.43 - 5.4.45
2 years, 9 months, 13 days, 11 hours, 38 minutes, 59 seconds
Output for 5.4.40 - 5.4.42
2 years, 9 months, 13 days, 11 hours, 39 minutes, 00 seconds
Output for 5.4.36 - 5.4.39
2 years, 9 months, 13 days, 11 hours, 39 minutes, 01 seconds
Output for 5.4.29 - 5.4.35
2 years, 9 months, 13 days, 11 hours, 39 minutes, 02 seconds
Output for 5.4.25 - 5.4.28
2 years, 9 months, 13 days, 11 hours, 39 minutes, 03 seconds
Output for 5.4.18 - 5.4.24
2 years, 9 months, 13 days, 11 hours, 39 minutes, 04 seconds
Output for 5.4.14 - 5.4.17
2 years, 9 months, 13 days, 11 hours, 39 minutes, 05 seconds
Output for 5.4.9 - 5.4.13
2 years, 9 months, 13 days, 11 hours, 39 minutes, 06 seconds
Output for 5.4.4 - 5.4.8
2 years, 9 months, 13 days, 11 hours, 39 minutes, 07 seconds
Output for 5.4.0 - 5.4.3
2 years, 9 months, 13 days, 11 hours, 39 minutes, 08 seconds
Output for 5.3.26 - 5.3.29
2 years, 9 months, 13 days, 11 hours, 39 minutes, 09 seconds
Output for 5.3.22 - 5.3.25
2 years, 9 months, 13 days, 11 hours, 39 minutes, 10 seconds
Output for 5.3.17 - 5.3.21
2 years, 9 months, 13 days, 11 hours, 39 minutes, 11 seconds
Output for 5.3.12 - 5.3.16
2 years, 9 months, 13 days, 11 hours, 39 minutes, 12 seconds
Output for 5.3.8 - 5.3.11
2 years, 9 months, 13 days, 11 hours, 39 minutes, 13 seconds
Output for 5.3.4 - 5.3.7
2 years, 9 months, 13 days, 11 hours, 39 minutes, 14 seconds
Output for 5.3.1 - 5.3.3
2 years, 9 months, 13 days, 11 hours, 39 minutes, 15 seconds
Output for 5.3.0
2 years, 9 months, 13 days, 11 hours, 39 minutes, 16 seconds
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/GkNmk on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/GkNmk 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/GkNmk 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/GkNmk on line 2