You should probably use DateTime.ParseExact to parse the date if you know the exact format you expect from the date. For your purposes, the following is likely to work.
string dateString, format; DateTime result; CultureInfo provider = CultureInfo.InvariantCulture; dateString = "15/08/2000 16:58" format = "dd/MM/yyyy HH:mm" result = DateTime.ParseExact(dateString, format, provider);
Go to the next one. Changed hh to HH because HH means 24 hour time. If you are not using a leading zero, just use H. For more information on creating format strings, see this article .
Also from a related MSDN article, it seems that the "g" format should work.
dateString = "15/06/2008 08:30"; format = "g"; CultureInfo provider = new CultureInfo("fr-FR"); DateTime result = DateTime.ParseExact(dateString, format, provider);
Kibbee
source share