3v4l.org

run code in 300+ PHP versions simultaneously
<?php $format = 'Y-m-d\TH:i:s.v\Z'; $stringDateTime = (new \DateTime())->format($format); var_dump(date_create($stringDateTime));
Output for 8.0.23, 8.0.27, 8.1.8, 8.1.24, 8.1.29, 8.2.6 - 8.2.7, 8.2.10 - 8.2.11, 8.2.13, 8.2.20, 8.3.2, 8.3.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.004000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.3.28, 8.2.18 - 8.2.19, 8.3.4, 8.3.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.007000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.3.17, 7.3.19 - 7.3.20, 7.3.25, 7.4.4, 7.4.9, 7.4.12, 8.0.0, 8.0.3, 8.1.28, 8.2.17, 8.3.3, 8.3.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.008000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.2.31 - 7.2.32, 7.3.16, 7.3.21, 7.4.11, 8.0.2, 8.2.16, 8.3.5
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.009000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.3.29 - 7.3.31, 7.4.5, 7.4.13, 7.4.20, 7.4.22 - 7.4.24, 7.4.26 - 7.4.29, 8.0.1, 8.0.5 - 8.0.7, 8.0.9 - 8.0.12, 8.0.14 - 8.0.22, 8.0.24 - 8.0.26, 8.0.28 - 8.0.30, 8.1.0 - 8.1.7, 8.1.9 - 8.1.22, 8.1.25 - 8.1.27, 8.2.0 - 8.2.1, 8.2.3 - 8.2.5, 8.2.8 - 8.2.9, 8.2.12, 8.2.14 - 8.2.15, 8.3.1
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.003000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.3.18, 8.2.2, 8.3.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.006000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 8.1.23
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.005000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.3.32, 7.4.25, 8.0.13
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 16:27:28.002000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 8.0.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.014000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.4.30 - 7.4.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.002000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.2.29 - 7.2.30, 7.3.26, 7.4.10, 7.4.14, 7.4.21
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.010000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.4.16
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.016000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.4.8
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.015000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.3.23 - 7.3.24, 7.4.7
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.011000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.0.33, 7.1.0 - 7.1.5, 7.1.7 - 7.1.33, 7.2.0 - 7.2.26, 7.3.0 - 7.3.13, 7.4.0 - 7.4.1, 7.4.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.3.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 16:27:28.001000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.2.33
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.012000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 7.1.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2019-03-04 17:27:28.059000" ["timezone_type"]=> int(2) ["timezone"]=> string(1) "Z" }
Output for 5.6.38
bool(false)

preferences:
172.06 ms | 401 KiB | 220 Q