PHP / RSS显示1969年的日期

时间:2014-07-31 00:03:59

标签: php mysql rss

我最近为我的网站制作了一个RSS源,它运行正常,但我似乎没有得到正确的日期,在我的数据库中,这个阵营被命名为nw_Fecha,它的类型是DATETIME阵营。这是我的代码:

<?php include ('inc_conexiones.php');?>
<?php 
 mysql_set_charset('utf8', $cnxMySQL);
 mysql_select_db($BaseDeDatos);
?>
<?php 
 ob_start('limpiar');
 function limpiar($buffer){
    return trim($buffer);
}
?>
<?php header("Content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
$sql = "Select * From tb_noticias Where nw_Status='activo' Order by nw_Fecha DESC LIMIT 10";
$result = mysql_query($sql) or die("Query failed : " . mysql_error());
$date = $row['nw_Fecha'];


echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:itunes=\"http://www.itunes.com/dtds/podcast-1.0.dtd\">\n";

echo "<channel>\n";
echo "<title>Noticias >> www.torosdetijuana.com</title>\n";
echo "<link>http://torosdetijuana.com</link>\n";
echo "<language>es-mx</language>\n";
echo "<copyright>torosdetijuana.com</copyright>\n";

while ($row = mysql_fetch_array($result))
{

   echo "<item>\n";
   echo "<title>" . $row["nw_Titulo"] . "</title>\n";
   echo "<description>" . $row["nw_Resumen"] . "</description>\n";
   echo "<link>http://torosdetijuana.com/noticiasid.php?id=".$row["nw_ID"]."</link>\n";
   echo "<pubDate>".date('Y/m/d', strtotime($date))."</pubDate>\n";
   echo "</item>\n";
}

echo "</channel>";
echo "</rss>";
?>

<?php 
ob_end_flush();
?>

正如我所说,一切正常,除此之外。我似乎无法在这里找到错误。

0 个答案:

没有答案