Date Format

Hi,

Just finished some code to pull a blog feed onto my website.

Can anyone tell me how to format the date differently, it currently looks a bit nasty with seconds on there -http://www.newmountainrider.com/news.php


		<?php
        
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, 'http://newmountainrider.blogspot.com/feeds/posts/default?alt=rss');
			curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			$data = curl_exec($ch);
			curl_close($ch);
				
			$xml = new SimpleXMLElement($data);
			
			$i=0;/*Limit to 10 items*/
			
			foreach($xml->channel->item as $post) {
				
			if ($i<10){
				echo '<h1>';
				echo $post->title;
				echo '</h1><b>';
				echo $post->pubDate;
				echo '</b><br />';
				echo $post->description;
				echo '<br /><hr />';
			$i++;}
			}
        ?>

Was thinking maybe just “WEDNESDAY, 25 AUGUST 2010”

thanks all

yusss! thanks buddy

You have to execute that code inside the foreach loop right after the if $i < 10

thanks,

have i done this right?

its showing the date “Thursday, 01 January 1970” on every post http://newmountainrider.com/news.php

<?php
        
			$ch = curl_init();
			curl_setopt($ch, CURLOPT_URL, 'http://newmountainrider.blogspot.com/feeds/posts/default?alt=rss');
			curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			$data = curl_exec($ch);
			curl_close($ch);
				
			$xml = new SimpleXMLElement($data);
			
			$xml_date = $post->pubDate;
			$xml_strdate = strtotime($xml_date);
			$xml_showdate = date('l, d F Y',$xml_strdate);

			$i=0;/*Limit to 10 items*/
			
			foreach($xml->channel->item as $post) {
				
			if ($i<10){
				echo '<h1>';
				echo $post->title;
				echo '</h1><b>';
				echo $xml_showdate;
				echo '</b><br />';
				echo $post->description;
				echo '<br /><hr />';
			$i++;}
			}
        ?>

Hmm…



$xml_date = $post->pubDate;
$xml_strdate = strtotime($xml_date);
$xml_showdate = date('l, d F Y',$xml_strdate);

echo $xml_showdate;