I am getting error while converting string to datetime.
string dateStarted= "Wed Nov 27 2019 20:37:46 GMT+0700 (Indochina Time)";
DateTime startedDate = DateTime.Parse(dateStarted);
You should use ParseExact
to convert string to datetime
var date = DateTime.ParseExact(
"Wed Nov 27 2019 20:37:46 GMT+0700 (Indochina Time)",
"ddd MMM dd yyyy HH:mm:ss 'GMT+0700 (Indochina Time)'",
CultureInfo.InvariantCulture);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.