Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7726579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:15:04+00:00 2026-06-01T05:15:04+00:00

My task is to retrieve data from XML file. Every node in XML file

  • 0

My task is to retrieve data from XML file.
Every node in XML file contains date and time. To read and convert it I’m using the following:

date = DateTime.ParseExact(turnoNode.SelectSingleNode(“FechaHoraAlta”).InnerText, “dd/MM/yyyy hh:mm:ss”, CultureInfo.InvariantCulture);

For the first two nodes it converts dates correctly:

<FechaHoraAlta>19/04/2012 10:00:36</FechaHoraAlta>
<FechaHoraAlta>19/04/2012 11:00:05</FechaHoraAlta>

The problem occurs for the third node containing:

<FechaHoraAlta>22/04/2012 19:37:52</FechaHoraAlta>

Then FormatException exception is thrown saying that string was not recognized as a valid DateTime.

I tried to debug it, all I know is that it gets InnerText correctly, it’s “22/04/2012 19:37:52”. It just cannot convert it, but I have no idea why.

I saw a lot of similar problems here on stackoverflow, but so far I haven’t found any proper solution.

Does someone know what the problem can be?

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:15:05+00:00Added an answer on June 1, 2026 at 5:15 am

    Look at your format pattern:

    "dd/MM/yyyy hh:mm:ss"
    

    “hh” means a twelve hour clock, usually in conjunction with “tt” for the AM/PM designator. So 19 isn’t a valid value. You want “HH” instead of “hh”, as “HH” uses the 24 hour clock.

    See MSDN on custom date and time format strings for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to retrieve the text data from an ePub file using Java.
I have the following beans Task, ServerDetails and ApplicationDetails. I wish to retrieve all
I'm trying to design a bulk data import task using Django's ORM ontop of
Consider the following query: SELECT operation, [...] FROM tableName The operation field will retrieve
Goal: Retrieve data aaa from the first td in tr by pressing the link
I am building a small program to retrieve data from the market and chart
I have a data flow task that extracts data from one database and inserts
TASK : I have an existing xml document (UTF-8) which uses xml namespaces and
My task is to decompress a packet(received) using zlib and then use an algoritm
My main application does this: It retrievs data from the internet and has 3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.