Exception on DateTime.Parse

Oct 9, 2012 at 11:26 PM

Hi,
Just downloaded latest, , 79962, and it fails in Cached.cs, becase the datetime that is being parsed is in USA date format.

This frig works!

        public static DateTime TimeStamp(XDocument xDoc)
        {
            var t = xDoc.Descendants("timestamp").First().Value;
            t = "22/07/2010 4:55:04 PM";
            return DateTime.Parse(t);
        }

This fails, 7/22/2010 4:55:04 PM
I wonder if your based in the USA and haven't seen this before.
I'm based in UK.
If I found out more about DateTime.Parse(), I'll post.
thanks
John
Coordinator
Oct 10, 2012 at 4:20 PM

You are likely correct - I will take a look at this as well, let me know what you find out!

Coordinator
Oct 10, 2012 at 4:26 PM

Looks like we should use DateTime.Parse(string, IFormatProvider) or DateTime.ParseExact(string, string, IFormatProvider)