Solved

RSS formatting pubDate element value

Posted on 2009-05-10
4
871 Views
Last Modified: 2013-11-18
I am trying to format pubDate value in MM/DD/YY format in my Javascript. Can anyone give me pointers ?
document.getElementById("chan").innerHTML ="";
	for (var i=0; i<RSS.items.length; i++)
	{	
 
		var item_title = RSS.items[i].title;
		var item_url = RSS.items[i].link;
		var item_date = RSS.items[i].pubDate;
		
		document.getElementById("chan").innerHTML += "<a href ="+ item_url + " target='_blank'>" + item_title +  "</a> " + item_date + "<br>";
	}

Open in new window

0
Comment
Question by:dmanchikalapudi
4 Comments
 

Accepted Solution

by:
dmanchikalapudi earned 0 total points
ID: 24359446
Thank you. I solved this issue ... if anyone is still looking for an answer ... here it is ... I used DateFormat class to parse the pubDate string to a java Date object.



DateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
Date publishedDate = df.parse(((Item) getChannelItems()[currentIteration]).getPubDate().toString().trim());

Open in new window

0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question