3v4l.org

run code in 300+ PHP versions simultaneously
<?php $currentDate = new \DateTime; echo 'Current Time: ' . $currentDate->format('h:i a') . PHP_EOL; $sd = "20th Dec, 2016"; $dt = DateTime::createFromFormat("dS M, Y", $sd); $strtotime = strtotime($dt->format("d-M-Y")); $dt2 = DateTime::createFromFormat("!dS M, Y", $sd); echo 'general' . \PHP_EOL; echo "\t" . $dt->format('Y-m-d h:i a') . \PHP_EOL; echo "\t" . $dt->getTimestamp() . \PHP_EOL; echo 'with !' . \PHP_EOL; echo "\t" . $dt2->format('Y-m-d h:i a') . \PHP_EOL; echo "\t" .$dt2->getTimestamp() . \PHP_EOL; echo 'strtotime' . \PHP_EOL; echo "\t" . date('Y-m-d h:i a', $strtotime) . PHP_EOL; echo "\t" . $strtotime . PHP_EOL;
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31, 7.4.4 - 7.4.5, 7.4.7 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
Current Time: 04:46 pm general 2016-12-20 04:46 pm 1482248801 with ! 2016-12-20 12:00 am 1482188400 strtotime 2016-12-20 12:00 am 1482188400
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 7.3.32 - 7.3.33, 8.0.13
Current Time: 02:46 pm general 2016-12-20 02:46 pm 1482245201 with ! 2016-12-20 12:00 am 1482192000 strtotime 2016-12-20 12:00 am 1482192000
Output for 7.4.6
Current Time: 08:51 pm general 2016-12-20 08:51 pm 1482263495 with ! 2016-12-20 12:00 am 1482188400 strtotime 2016-12-20 12:00 am 1482188400
Output for 7.4.0
Current Time: 06:08 pm general 2016-12-20 06:08 pm 1482253684 with ! 2016-12-20 12:00 am 1482188400 strtotime 2016-12-20 12:00 am 1482188400
Output for 7.1.32 - 7.1.33, 7.2.22 - 7.2.24, 7.3.9 - 7.3.12
Current Time: 01:15 pm general 2016-12-20 01:15 pm 1482236123 with ! 2016-12-20 12:00 am 1482188400 strtotime 2016-12-20 12:00 am 1482188400
Output for 7.1.25 - 7.1.31, 7.2.0 - 7.2.21, 7.3.0 - 7.3.8
Current Time: 01:15 pm general 2016-12-20 01:15 pm 1482236124 with ! 2016-12-20 12:00 am 1482188400 strtotime 2016-12-20 12:00 am 1482188400
Output for 5.6.38, 7.0.33, 7.1.15 - 7.1.24
Current Time: 10:42 pm general 2016-12-20 10:42 pm 1482270126 with ! 2016-12-20 12:00 am 1482188400 strtotime 2016-12-20 12:00 am 1482188400
Output for 7.1.0 - 7.1.14
Current Time: 10:42 pm general 2016-12-20 10:42 pm 1482270127 with ! 2016-12-20 12:00 am 1482188400 strtotime 2016-12-20 12:00 am 1482188400

preferences:
169.72 ms | 418 KiB | 5 Q