Jump to content

RSS feed - correct time?


ruddie

Recommended Posts

Hello, I got myself a RSS feed for my posts, which can be seen here:

codexplained.tk/feed/rss.php

 

This is the code used for it:

<?php	
// header
header("Content-Type: application/xml; charset=UTF-8");
require("../widgets/functions.php");

// Make a MySQL Connection
connectToDB();	

echo '
	<rss version="2.0">
	<channel>
	<title>Codexplained RSS Feed</title>
	<link>http://www.codexplained.tk</link>
	<description>For all your coding needs</description>
	<language>en</language>
';

$query = "SELECT * FROM posts ORDER BY Id DESC LIMIT 15";
$res = mysql_query($query);

$num=mysql_numrows($res);	

$i = 0;	
while ($i < $num)
{	
	$subject=mysql_result($res,$i,"Subject");
	$id=mysql_result($res,$i,"Id");
	$content=mysql_result($res,$i,"Content");	

	$content = str_replace("<br />", "\n", $content);
	$content = str_replace("<?php", "<?php", $content);	
	$content = str_replace("?>", "?>", $content);		
	$content = htmlentities($content);	
	$content = substr($content, 0,400);		

	echo '
		<item>
		<title>'.$subject.'</title>
		<link>http://www.codexplained.tk/index.php?postDetails='.$id.'</link>			
		<description>'.$content.'</description>
		</item>';	
	$i++;
}
echo '
	</channel>
	</rss>
	';
?>

 

Now, I wish to know how to make the time display correctly, and not just according to refresh date.

 

I tried something with <pubDate> but I couldn't figure it out. Help would be appreciated!

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.