3v4l.org

run code in 300+ PHP versions simultaneously
<?php $base = DateTime::createFromFormat('!Y-m-d H:i:s', '2018-08-20 12:34:56'); echo DateTime::createFromFormat('!Y-m-d H:i:s d', $base->format('Y-m-d H:i:s 21'))->format("Y-m-d H:i:s\n"); echo DateTime::createFromFormat('!U d', $base->format('U 21'))->format("Y-m-d H:i:s\n");
Output for 7.1.0 - 7.1.21, 7.2.0 - 7.2.33, 7.3.16 - 7.3.21, 7.4.0 - 7.4.9, 8.0.0alpha1 - beta1
2018-08-21 12:34:56 2018-09-09 10:34:56