How to format this date?

S

Shapper

Hello,

I have an ASP.Net Repeater where I display a date from a date field:
<%# DataBinder.Eval(Container.DataItem, "pubDate", "{0:f}") %>

When the dataset is created from a database the date text format change
when Thread.CurrentThread.CurrentCulture change.

However, when I create the dataset from a XML (RSS 2.0 Format) file the
date is allways the entire text taken from the <pubdate> node.

I believe I need to convert the pubDate field in my dataset to a
convenient date format.

Here is my code which create the dataset from the XML (RSS 2.0 Format)
file:

Dim news As New XmlDocument()
news.Load("http://www.domain.com/_rss/news.rss")
Dim x As Integer
Dim xNodeList As XmlNodeList =
news.SelectNodes("/rss[@version='2.0']/channel/item")
Dim dsNews As DataSet = New DataSet()
Dim xReader As XmlTextReader
For x = 0 To xNodeList.Count-1
xReader = New XmlTextReader(xNodeList.item(x).OuterXml,
XmlNodeType.Element, new XmlParserContext(Nothing, Nothing, Nothing,
XmlSpace.None))
dsNews.ReadXml(xReader, XmlReadMode.InferSchema)
Next x

An example of a XML (RSS 2.0 Format) file:

<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>News</title>
<description>Latest News</description>
<item>
<title>Title</title>
<link>Url</link>
<description>Description</description>
<pubDate>Fri, 20 May 2005 12:30:00 GMT</pubDate>
</item>
...

Can someone help me out?

Thanks,
Miguel
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top