ldoozer Posted July 15, 2010 Share Posted July 15, 2010 I have retrieved a date from a blogger feed using magpierss and am returning 2009-03-02T14:19:00.003Z as the date. Can anyone help in converting this to Monday 2nd March 2009. Link to comment https://forums.phpfreaks.com/topic/207810-formating-date-format-2009-03-02t141900003z/ Share on other sites More sharing options...
Mchl Posted July 15, 2010 Share Posted July 15, 2010 strtotime date Link to comment https://forums.phpfreaks.com/topic/207810-formating-date-format-2009-03-02t141900003z/#findComment-1086319 Share on other sites More sharing options...
ldoozer Posted July 15, 2010 Author Share Posted July 15, 2010 I have read these pages and used them in the past to format mysql date format but this hasn't helped me for this problem - can anyone write the code and talk it through? Link to comment https://forums.phpfreaks.com/topic/207810-formating-date-format-2009-03-02t141900003z/#findComment-1086341 Share on other sites More sharing options...
Mchl Posted July 15, 2010 Share Posted July 15, 2010 We're feeling lazy today? date('l jS F Y',strtotime('2009-03-02T14:19:00.003Z')); Link to comment https://forums.phpfreaks.com/topic/207810-formating-date-format-2009-03-02t141900003z/#findComment-1086345 Share on other sites More sharing options...
ldoozer Posted July 15, 2010 Author Share Posted July 15, 2010 Thanks v much - I have used it like this below... but now its returning Thursday 1st January 1970 for every post. I am a complete novice so sorry for my ignorance. <?php define('MAGPIE_DIR', 'magpie/'); require_once(MAGPIE_DIR.'rss_fetch.inc'); $num_items = 10; $rss = fetch_rss( 'http://care4air.blogspot.com/rss.xml' ); print_r(); $items = array_slice($rss->items, 0, $num_items); //display latest blog content: foreach ($items as $item) { $published = $item['published']; $content = $item['atom_content']; //$author = $item['author_name']; $fDate = date('l jS F Y',strtotime('$published')); echo "<h2 id=\"news_story\">$fDate</h2>\n"; echo "<p>$content</p>\n"; //echo "<p>$author</p>\n"; echo "<hr />\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/207810-formating-date-format-2009-03-02t141900003z/#findComment-1086368 Share on other sites More sharing options...
Mchl Posted July 15, 2010 Share Posted July 15, 2010 Why did you put quotes around $published ? Link to comment https://forums.phpfreaks.com/topic/207810-formating-date-format-2009-03-02t141900003z/#findComment-1086370 Share on other sites More sharing options...
ldoozer Posted July 15, 2010 Author Share Posted July 15, 2010 removed quotes and working great - thanks for your support Link to comment https://forums.phpfreaks.com/topic/207810-formating-date-format-2009-03-02t141900003z/#findComment-1086433 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.