sketchgal — 2013-10-08T15:23:15-04:00 — #1
Can someone please help me?
I have a date which is being echoed in the following format:
Thu, 3 Oct 2013 11:15:06 +0100
How can I get this to display like this 03 Oct?
Any help greatly appreciated with this, Thanks in advance.
cups — 2013-10-08T15:27:39-04:00 — #2
Can you show the few lines echoing this?
sketchgal — 2013-10-08T15:34:55-04:00 — #3
Thanks for the reply Cups!
The date is coming from an rss feed which I'm publishing on my webpage.
All I'm doing to display the date is <?php echo $pubDate;?> and thats how it displays.
Does that help any?
scallioxtx — 2013-10-08T15:41:11-04:00 — #4
$date = new DateTime($pubDate);
echo $date->format('M m');
Or, in PHP <5.3:
$date = strtotime($pubDate);
echo date('M m', $date);
sketchgal — 2013-10-08T15:59:08-04:00 — #5
Thanks very much for the help guys!
salathe — 2013-10-09T02:41:11-04:00 — #6
Your code will work just fine in any version of PHP that has the
DateTime class: that is, PHP >= 5.2.0.