You can have space characters though to parse using
DateTimeStyles.AllowWhiteSpaces.
In your case, you may have to insert "/". If month and day are switched, you
have to specify FormatProvider in the argument.
IFormatProvider culture = new CultureInfo("en-US", true);
Try this
string myDate= "02 22 2004";
IFormatProvider culture = new System.Globalization.CultureInfo("en-US",
true);
DateTime a =
DateTime.Parse(myDate,culture,System.Globalization .DateTimeStyles.AllowWhite
Spaces);
--
Shak
(Houston)
"Bill" <nf*@nospam.com> wrote in message
news:OV**************@TK2MSFTNGP10.phx.gbl...
I am being passed a string value in the form of MMddyyyy that needs to be
converted to DateTime. Do I need to first convert the string to MM/dd/yyyy
before calling the DateTime.Parse(string) method?