Need to convert this string: Mon Oct 31 16:18:15 CDT 2011
Into a valid DateTime value.
Have tried every variation of the date time styles with DateTime.Parseto no avail.
Any ideas?
Need to convert this string: Mon Oct 31 16:18:15 CDT 2011
Into a valid DateTime value.
Have tried every variation of the date time styles with DateTime.Parseto no avail.
Any ideas?
The problem is with the CDT you have there. This is not a valid portion of a string representing a DateTime.
You may have luck with replacing this with a valid representation of a timezone -0500 and the K format specifier for it.
You can use the following format string to parse the string:
ddd MMM dd HH:mm:ss CDT yyyy
For instance:
DateTime.ParseExact("Mon Oct 31 16:18:15 CDT 2011", 
                    "ddd MMM dd HH:mm:ss CDT yyyy", 
                    CultureInfo.InvariantCulture);
I suggest reading the documentation for Custom Date and Time Format Strings on MSDN.