[2005] Parse a DateTime value from XML file
Hi,
We are receiving XML feed from a service provider for a Match between TeamA & TeamB. In that feed among all the other stuff there is a DateTime node. Sample is below.
Code:
<NFL>
<DATE>10-08</DATE>
<WORDCOUNT>0000</WORDCOUNT>
<DATETIME>st 10-08-06 13:42 et</DATETIME>
<AWAYTEAM>WASHINGTON</AWAYTEAM>
<HOMETEAM>NYGIANTS--</HOMETEAM>
</NFL>
All nodes are processed fine but I am having problems understanding the foramt of <DateTime> node's innertext. Can someone help me out on how to parse it and what does the "st" and "et" stands for?
I need to convert the <DateTime> in Eastern Daylight Time (GMT -5, GMT -4 DST)
Any help is appreciated.
Cheers :)
Re: [2005] Parse a DateTime value from XML file
How as that value written in the first place? It doesn't look like a standard date/time format as far as I can tell.
Re: [2005] Parse a DateTime value from XML file
Quote:
Originally Posted by jmcilhinney
How as that value written in the first place? It doesn't look like a standard date/time format as far as I can tell.
Yeah that is exactly what I thought too. We are getting this from ESPN (I think) and they are giving us the XML feed file, I assume the data is coming from their database.
Looking at the documentation gives me this.
Quote:
The <DateTime> tag contains a timestamp indicating when the message was transmitted.
Re: [2005] Parse a DateTime value from XML file
In this text "st 10-08-06 13:42 et"
st stands for Standard Time (versus daylight saving time)
et stands for Eastern Time (timezone)
10-08-06 13:42 is the date and time in MM-dd-yy HH:mm format.
Just a guess though....
Re: [2005] Parse a DateTime value from XML file
Yeah that is what I have fugured after thinking about it and that is the only thing which makes sense.
I assume when daylight savings is in order then the st would probably be replaced by dt. Again the documentation doesn't mention this at all.
Thanks for helping me with such a vague information.
Re: [2005] Parse a DateTime value from XML file
It looks to me like you're just going to have to parse the prefix and suffix yourself, with no specific help from the Framework. Someone recently posted a TimeZoneInfo class in the CodeBank which may prove useful at some point. As for the actual date/time part, the Date.Parse or .ParseExact method will do the job there.
Re: [2005] Parse a DateTime value from XML file
Yups that is already being done. I just needed extra help with the "st" and "et".
Thanks all for your input :)