views:

37

answers:

1

I'm using MagpieRSS to parse some Craigslist feeds.

The problem is the publish dates for craigslist posts are in this format: 2010-02-25T18:09:38-06:00

How can I convert that to Thursday, February 25, 2010 6:09 PM using php?

+2  A: 
date('l, F d, Y h:i A', strtotime($the_date));

date()

edit:

date(DATE_RFC822, strtotime($the_date));

is close, but doesn't match your requirements exactly (i.e. it uses abbreviated days / months, 24hour time and includes a timezone string) as specified in RFC822

jasonbar
This works except it shows the time 1 hour ahead of what's on the rss feed, although that may not have to do with formatting.
Chad
@Chad: If your server's timzezone is not GMT-0600 that would explain the difference.
jasonbar
Makes sense, that's what I was thinking. Thanks.
Chad