javascript - How do I remove the time from a feed published date -
i have created rss feed using google feed api , need remove 'published time' published date , show 'date'.
i have piece of code.
function rssfeedsetup() { var feedpointer = new google.feeds.feed(feedurl) //google feed api method feedpointer.setnumentries(feedlimit) //google feed api method feedpointer.load(displayfeed) //google feed api method } function displayfeed(result) { if (!result.error) { var thefeeds = result.feed.entries (var = 0; < thefeeds.length; i++) rssoutput += "<li><a href='" + thefeeds[i].link + "'>" + thefeeds[i].publisheddate + "</a></li>" rssoutput += "</ul>" feedcontainer.innerhtml = rssoutput } else alert("error fetching feeds!") } window.onload = function () { rssfeedsetup() }
can this?
you can create date in javascript publisheddate string , extract year, month , day.
var dt = new date(thefeeds[i].publisheddate); dt.getfullyear() + '/' + (dt.getmonth() + 1) + '/' + dt.getdate();
getmonth() need +1 cuz getmonth return array, start in 0
Comments
Post a Comment