Hi all,
This has prob been asked before, but for my own understanding I wanted to start fresh.
I am retrieving news articles from a MySQL table, the field is datetime so the data is stored like:
2006-02-21 00:00:00
I'm having difficulty reformatting the date and time when I want to display an article or output it in an RSS feed. Basically I've been using this method:
$date = $row['created'];
$day = substr($date,8,2);
$Month = substr($date,5,2);
$Year = substr($date,0,4);
$Date = mktime(0,0,0,$Month,$day,$Year);
$modified_on = date("d/m/Y", $Date);
I gotta believe this is a really long winded method and it doesn't cater for the time, which I have to do separately. Can someone show me a better way, a way to set the format for the date and time together, in such a way that will be usable for an RSS <pubdate>? I've gotten used to using this method but I can't imagine it's the best way and in any case it no longer serves my requirements, being that I need to show the time
Any help would be much appreciated, cheers. Just as a side note, I'm in the UK so normally would display dates as Day/Month/Year.