3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $today = new DateTime(); $currentLocationTime = new DateTime( '2014-08-01 16:27:33' ); //formatting date time string to date $gap = date_diff( $today, $currentLocationTime ); echo $gap->days; ?>
based on b5pAF
Output for 5.3.0 - 5.4.32, 5.6.28, 7.0.14 - 7.1.0
31
Output for 7.0.6
640
Output for 7.0.5
610
Output for 7.0.4
586
Output for 7.0.3
594
Output for 7.0.2
598
Output for 7.0.1
600
Output for 7.0.0
603
Output for 5.6.21
639
Output for 5.6.20
617
Output for 5.6.19
584
Output for 5.6.18
591
Output for 5.6.17
595
Output for 5.6.16
604
Output for 5.6.15
605
Output for 5.6.14
609
Output for 5.6.13
622
Output for 5.6.12
627
Output for 5.6.11
630
Output for 5.6.10
632
Output for 5.6.9
634
Output for 5.6.8
637
Output for 5.5.35
659
Output for 5.5.34
618
Output for 5.5.33
585
Output for 5.5.32
593
Output for 5.5.31
597
Output for 5.5.30
608
Output for 5.5.29
624
Output for 5.5.28
628
Output for 5.5.27
629
Output for 5.5.26
633
Output for 5.5.25
635
Output for 5.5.24
661
Output for 5.4.39 - 5.4.45
415
Output for 5.4.34 - 5.4.38
215
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined function date_diff() in /in/lVSXc on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/lVSXc 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/lVSXc 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/lVSXc on line 2