Problem with DateTime.Parse

  • Thread starter Thread starter Tobias Olbort
  • Start date Start date
T

Tobias Olbort

Hello,

why does this not work (the OS runs with german settings):

DateTimeFormatInfo dtFI = new DateTimeFormatInfo();

dtFI.FullDateTimePattern = "ddd MMM dd HH:mm:ss yyyy";
dtFI.AbbreviatedDayNames = new string[] {"Mon", "Tue", "Wed",
"Thu", "Fri", "Sat", "Sun"};
dtFI.AbbreviatedMonthNames = new string[] {"Jan", "Feb", "Mar",
"Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ""};
return DateTime.Parse("Fri Aug 01 09:03:43 2003", dtFI);

Thanks for any suggestion.

Tobias
 
Hello Tobias,

Try a simpler solution:

System.IFormatProvider format =
new System.Globalization.CultureInfo("en-US", true);

return DateTime.Parse("Fri Aug 01 09:03:43 2003", format);
 
Back
Top