php - Change XML date from yyyymmdd to Month Day, Year -
i'm using php output data xml file, date, outputs "20101110."
can use php change november 10, 2011? if so, how?
here's page , code:
$file = 'http://www.gostanford.com/data/xml/events/m-baskbl/2010/index.xml'; $xml = simplexml_load_file($file); foreach($xml $event_date){ if(!empty($event_date->event['vn']) && !empty($event_date->event['hn']) && !empty($event_date->event['vs']) && !empty($event_date->event['hs'])) { echo '<li>'; echo '<h3>', $event_date->event['vn'], ' vs ', $event_date->event['hn'], '</h3>'; echo '<p><strong>', $event_date->event['vs'], ' - ', $event_date->event['hs'], '</strong></p>'; echo '<p>', $event_date['date'], '</p>'; echo '<p>', $event_date->event['local_time'], '</p>'; echo '</li>'; } }
thanks help!
you can use date()
function, in combination strtotime()
function:
echo date('f j, y', strtotime($event_date['date']));
Comments
Post a Comment