custom date formatting

I

IM

hi,

I took out a part of my code so I can get some help.
objWriter.WriteStartElement("item"); // start of the "item" element -
one for each article
objWriter.WriteElementString("title",
objReader.GetValue(1).ToString()); // title of article
objWriter.WriteElementString("link",
"http://www.mysite.com/article.aspx?id=" +
objReader.GetValue(0).ToString()); // URL to access the article
objWriter.WriteElementString("description",
objReader.GetValue(2).ToString()); // abstract of the article
objWriter.WriteElementString("pubDate",
objReader.GetValue(3).ToString());//date of the article

objWriter.WriteEndElement(); // end of the "item"
element

This information I pull out of a database table and write it to an XML file
but the date used for "pubDate", objReader.GetValue(3).
=<pubdate>20-5-2005 15:38:39</pubdate> which also shows up in the xml file.

how can I get this date to get displayed the RSS way in the xml file.

thanks
Ru
 
I

IM

thx i checked it but not completely understand this what i did :

added the following lines:
DateTimeFormatInfo myDTFI = new CultureInfo( "en-US",
false ).DateTimeFormat;
DateTime myDT = new DateTime( 2002, 1, 3 );

and modified single line to:
objWriter.WriteElementString("pubDate",
objReader.GetValue(3).ToString("r"));

and get error:
CS1501: No overload for method 'ToString' takes '1' arguments

need some advice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top