how would I format a datetime string received from MySQL? For example, when I do
echo $info['start_datetime']
I get 2012-03-18 21:00:00, but I would like to Turn it into Sunday, March 18, 2012. I looked at the php documentation where it showed the different formats, but not specifically when they're retrieved from MySQL.
Thanks everyone!
echo date('l, F d, Y', strtotime($info['start_datetime']));
There are load of ways you can format the date. First change the time into timestamp using strtotime() function.
Check this page to get the list of how to format a date.
The usage is something like this
$time = strtotime($info['start_datetime']);
echo date("l, F d, Y", $time);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With