问题
Can someone tell me how should I approach converting the following format to a proper DateTime
object?
11:50:46 AM on Wednesday, October 19, 2011
回答1:
string s = "11:50:46 AM on Wednesday, October 19, 2011";
DateTime dateTime = DateTime.ParseExact(s,
"hh:mm:ss tt on dddd, MMMM dd, yyyy", CultureInfo.InvariantCulture);
来源:https://stackoverflow.com/questions/11433480/parsing-a-complicated-string-as-datetime