Results 1 to 7 of 7

Thread: [2005] Parse a DateTime value from XML file

  1. #1

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    [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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    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.

    The <DateTime> tag contains a timestamp indicating when the message was transmitted.
    Last edited by wrack; Oct 10th, 2007 at 11:39 PM.

  4. #4
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    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....

  5. #5

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    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.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  7. #7

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Resolved 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width