I have a short program that converts a string to a date and time format from a simple string.
However, it seems that String is not being reconstructed for a system that needs to be converted to a date time format due to the string sequence. The string to be converted is an example, for example: "Thu Dec 9 05:12:42 2010"
The method is used Convert.ToDateTime, but does not work.
Can someone consult on codes? Thank!
String re = "Thu Dec 9 05:12:42 2010";
DateTime time = Convert.ToDateTime(re);
Console.WriteLine(time.ToString("dddd, dd MMMM yyyy HH:mm:ss"));
source
share