I had posted a question on DateTime to String conversion, I got many satisfying answers for that .. so I thank StackOverflow very much ..
Here is one more problem of String
Take a look at the TryParseExact method. Here's an example with the first case:
DateTime date;
// I changed 02/31/2009 to 01/31/2009 because the first is not a valid date
if (DateTime.TryParseExact("01/31/2009 01:59:59", "MM/dd/yyyy HH:mm:ss", null, DateTimeStyles.None, out date))
{
// string successfully parsed => do something with the date
}
You could then keep a list of different formats and try to parse the string with all of them until you succeed.