I receive a date from an array in the below format:
2014-10-22 07:24:57 EDT
I want to convert this to echo only the month and day like this: Oct 22
My code below works fine when I'm changing from the 15-Feb-2009
format.
<?php
$date = DateTime::createFromFormat('D-M-Y', '15-Feb-2009');
$nice_date = $date->format('M j');
echo $nice_date;
?>
Here's what I have that doesn't work. Probably not even close.
$array_date = '2014-10-22 07:24:57 EDT';
$date = DateTime::createFromFormat('YY-MM-DD HH:II:SS EDT', $array_date);
$nice_date = $date->format('M j');
echo $nice_date;
I'm at a loss right now. Any ideas?