Date format read from XML file

That’s my problem: I read the date from a xml file in the yyyy-mm-ddThh:mm:ss format. Example: 2015-06-10T08:56:44

Then I want to write this date in a new file but only in this format: 06/10/2015 (that is “MM/dd/yyy, without the time).

What I tried at first it was:

Date_Creation = Date.Parse(noeudEnf.InnerText.ToString)

But then I get the time and I don’t want it. So I tried to do this:

Date_Creation = DateTime.ParseExact(Date_Creation, “dd/MM/yyyy”, CultureInfo.InvariantCulture)

I thought the problem was the “-” instead of “/” in the xml file. I replaced them but I got the same. I don’t know what’s next! Please, help. Thank you!


Source: xml

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.