473,401 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

custom date formatting

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
2 1537
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
4
by: Paul | last post by:
Hi, Everything went fine getting a short date format out of SQL into my DataGrid with this: <%# DataBinder.Eval(Container.DataItem, "Created", "{0:d}")%> Then I got too fancy in SQL and...
2
by: johndcal | last post by:
Hello All, I have a date value that I pull from a .csv file. After reading the file and storing the values in an array the value of the date could be found in $array, for example....
2
by: David Veeneman | last post by:
How does one format a date column in a GridView control? I had assumed that the DataFormat string would do it, but MSDN only shows numeric formatting codes. Can dates be formatted using that...
2
by: rickholt | last post by:
Many years ago at IBM we had a text formatting language (DCF) which let you specify all sorts of microcommands to a page formatter. Not particularly exciting, but it was also a primitive...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
4
by: Val | last post by:
I have a complex object that I need to serialize. Rather than rely on a standard routine, which is called during the serialization/deserialization, I would like to be able to use my own functions...
7
by: creative1 | last post by:
Hello everyone. I am experiencing a strange problem that I can't fix on my own. I think I need expert's suggestions for this. The problem is: I want to print account statement (or any other...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
6
by: =?Utf-8?B?QmVu?= | last post by:
All - I have VB2008. On the form I have a date picker and a text box. I put would like to display a date format in the form of "MM-DD-YYYY" or "MM-YYYY" I am new to vb2008, can you show me...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.