3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $time=time(); $date = date("Y-m-d h:i:sa"); echo date_format($date,"Y/m/d H:i:s"); $d=mktime(14, 30, 00, date("d", $time), date("m", $time), date("Y", $time)); echo "<br />"."Created date is " . date("Y-m-d h:i:sa", $d); echo "<br />"."Current date is " . date("Y-m-d h:i:sa", $time); echo date_default_timezone_get(); $str_time = date("Y", $time)."-".date("m", $time)."-".date("d", $time)." 14:30:00"; echo $str_time; //echo "25-08-2011 17:30:30 = ".strtotime ("25-08-2011 17:30:30")." = ".date ("d-m-Y H:i:s", strtotime ("25-08-2011 17:30:30"))."<br>"; //echo "25-08-2011 17:31:17 = ".strtotime ("25-08-2011 17:31:17")." = ".date ("d-m-Y H:i:s", strtotime ("25-08-2011 17:31:17"))."<br>"; echo "====".date("H:i:s", strtotime ($str_time)-strtotime ($str_time))."===="; $localtime = localtime(); $localtime_assoc = localtime(time(), true); print_r($localtime); print_r($localtime_assoc);
based on M2MPb
Output for 7.0.20 - 7.2.0
Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in /in/7olCX on line 4 <br />Created date is 2015-04-11 02:30:00pm<br />Current date is 2015-11-04 11:52:07pmEurope/Amsterdam2015-11-04 14:30:00====01:00:00====Array ( [0] => 7 [1] => 52 [2] => 23 [3] => 4 [4] => 10 [5] => 115 [6] => 3 [7] => 307 [8] => 0 ) Array ( [tm_sec] => 7 [tm_min] => 52 [tm_hour] => 23 [tm_mday] => 4 [tm_mon] => 10 [tm_year] => 115 [tm_wday] => 3 [tm_yday] => 307 [tm_isdst] => 0 )
Output for 5.5.0 - 7.0.8
Warning: date_format() expects parameter 1 to be DateTimeInterface, string given in /in/7olCX on line 4 <br />Created date is 2015-04-11 02:30:00pm<br />Current date is 2015-11-04 11:52:06pmEurope/Amsterdam2015-11-04 14:30:00====01:00:00====Array ( [0] => 6 [1] => 52 [2] => 23 [3] => 4 [4] => 10 [5] => 115 [6] => 3 [7] => 307 [8] => 0 ) Array ( [tm_sec] => 6 [tm_min] => 52 [tm_hour] => 23 [tm_mday] => 4 [tm_mon] => 10 [tm_year] => 115 [tm_wday] => 3 [tm_yday] => 307 [tm_isdst] => 0 )