Skip to content
Advertisement

PHP date function to extract a raw timestamp?

I want to convert a human readable date time such as 20210419115522 to 2021-04-19 11:55:22 via PHP. How is it possible?

<?php
echo date('Ymd', 20210419115301);   <------ Not the result I expect

Advertisement

Answer

ex: $time = strtotime(“20210419115301”); echo date(“Y-m-d H:i:s”, $time);

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement