I'm working with a windows 8 app using Java Script
I'm get some rss and convert it to JSON format objects using Google API. So Then I got some sort of object array of JSON for that rss feed. I need to do is I want to select few objects among all objects of the array according to the published day. That means I want to get all objects from the array which published before 6 hours(In between current date and before 6 hours except other objects).. Can anyone help me for do that..?
I use this code for get all objects.
function loadNews() {
var allEntries = [];
var pendingRequestCount = listOfFeed.length;
var onRequestFinished = function () {
pendingRequestCount--;
if (pendingRequestCount === 0) {
processItems(allEntries);
}
};
for (var x = 0; x < listOfFeed.length; x++) {
feedburnerUrl = listOfFeed[x].url,
feedUrl = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&output=json&num=999&q=" + encodeURIComponent(feedburnerUrl);
WinJS.xhr({
url: feedUrl,
responseType: "rss/json"
}).done(function complete(result) {
var jsonData = JSON.parse(result.response);
var entries = jsonData.responseData.feed.entries;
allEntries = allEntries.concat(entries);
allEntries.sort(function (entry1, entry2) {// Compare the entries by publish date
return Date.parse(entry2.publishedDate) - Date.parse(entry1.publishedDate); // return get milisecond
});
onRequestFinished();
});
} //loop x finish}
}
According to the above cord, allEntries provide JSON object array
Very thankful for the your answers