Re: Problem with date
| From: | Joshua Kehn | Date: | Wed, 07 Dec 2011 18:51:05 +0000 |
| Subject: | Re: Problem with date | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-315945@lists.php.net to get a copy of this message | ||
$pubdate is probably null or something.
Regards,
–Josh
____________________________________
Joshua Kehn | @joshkehn
http://joshuakehn.com
On Dec 7, 2011, at 1:48 PM, Jack wrote:
> Hello All,
>
>
>
> I have a problem where Dates are coming out as 12.31.1969 19:00:00 which of
> course we didn't have PC's in 1969
>
> I'm not able to see where the date is getting screwed up, any ideas??
>
>
>
> //
> ############################################################################
> #
>
> function ShowFeed_RSS($XmlRoot) {
>
> $title = GetFirstChildContentByPath($XmlRoot, "channel/title");
>
> $link = GetFirstChildContentByPath($XmlRoot, "channel/link");
>
> $desc = GetFirstChildContentByPath($XmlRoot, "channel/description");
>
> # Next 2 lines display the title of the feed, and feed description
>
>
> # echo "<font face=arial color=blue size =2><b><a
> href=\"$link\">$title</a></b>\n";
>
> # echo "$desc";
>
> $nodelist = GetChildrenByPathAndName($XmlRoot, "channel", "item");
>
> if (!$nodelist) return 0;
>
> foreach ($nodelist as $nl) {
>
> $title = GetFirstChildContentByName($nl, "title");
>
> $link = GetFirstChildContentByName($nl, "link");
>
> $desc = GetFirstChildContentByName($nl, "description");
>
> $creator = GetFirstChildContentByName($nl, "author");
>
>
>
> # if (!$creator) $creator = GetFirstChildContentByName($nl,
> "dc:creator");
>
>
>
> # echo "JACK" . $nl . "<br>";
>
> # $pubdate = GetFirstChildContentByName($nl, "pubDate");
>
> if (!isset($pubdate)) $pubdate = GetFirstChildContentByName($nl,
> "dc:date");
>
> # if (!$pubdate) $pubdate = GetFirstChildContentByName($nl, "dc:date");
>
> if (isset($pubdate)) $pubdate = strtotime($pubdate);
>
> if (isset($pubdate)) $pubdate = strftime("%m.%d.%Y %H:%M:%S", $pubdate);
>
> $out = $creator;
>
>
>
> if ( ($creator != "") && ($pubdate != "") ) $out .= " @
> ";
>
>
> $out .= $pubdate;
>
> echo "<a class=\"rss-link\"
> href=\"$link\"><b>$title</b></a>";
>
> echo "<font size=1 color=\"black\"> $out<br>";
>
> echo "<font size=2>$desc<br><br>";
>
> # echo "<font size=1 class=rss-link>This is not green</font>";
>
>
>
> }
>
> # this line is after each rss feed group
>
> # echo "<hr>\n";
>
>
>
> }
>
>
>
>
>
>
>
> Thanks!
>
> Jack
>
>
>