3v4l.org

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