In the C#, I am parsing a date from string, but it gives me error
DateTime.Parse("07/26/2012");
the error
System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.DateTime.Parse(String s)
is it related to date format ? is it related to my pc setting ?
Thanks
By default,
Parseuses your current culture.ParseExactallows you to manually specify the date format.Try this instead:
The
InvariantCultureoption allows you to ignore the current culture settings on the system.