php – Convert Y-m-d H:i:s datetime to name of month, number of day, number of year, time (AM or PM)-ThrowExceptions

Exception or error:

In my database I have date information stored with the format Y-m-d H:i:s.

For example, there is a datetime with the value 2020-03-14 11:00:00

Using PHP, how do I reformat the data and echo it so that it reads:

“Saturday 14th of March 2020 11:00 AM”

Thanks in advance for looking into my question

How to solve:

Use this

$DatabaseDateTime = "2020-03-14 11:00:00";

echo date("l jS \of F Y h:i:s A",strtotime($DatabaseDateTime ));

Let me know if any problem occurs

Leave a Reply

Your email address will not be published. Required fields are marked *