By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,403 Members | 855 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,403 IT Pros & Developers. It's quick & easy.

custom date formatting

P: n/a
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
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Look up the MSDN help. Here is the topic online:

http://msdn.microsoft.com/library/de...matstrings.asp

Eliyahu

"IM" <mu****@yahoo.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
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

Nov 19 '05 #2

P: n/a
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.

"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:uj**************@TK2MSFTNGP14.phx.gbl...
Look up the MSDN help. Here is the topic online:

http://msdn.microsoft.com/library/de...matstrings.asp
Eliyahu

"IM" <mu****@yahoo.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
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


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.