I have a date in JavaScript and its value is coming like this
Fri Apr 01 2011 05:00:00 GMT+0530 (India Standard Time) {}
Now what is the best way to convert th
Expanding on @Naraen's answer, my javascript date was in the following format:
Thu Jun 01 2017 04:00:00 GMT-0400 (Eastern Standard Time)
Which required two lower case d's for the day (dd
) for the conversion to work for me in C#. See update to @Naraen's code:
DateTime.ParseExact(dateString.Substring(0,24),
"ffffd MMM dd yyyy HH:mm:ss",
CultureInfo.InvariantCulture);