I'm using http://www.eyecon.ro/bootstrap-datepicker/ plugin to select date, and after date is selected I get e.g. Fri Nov 01 2013 00:00:00 GMT+0100
1) Why am I getting that date format if I set up the plugin with format yyyy-mm-dd
?
2) How to parse Fri Nov 01 2013 00:00:00 GMT+0100
to DataTime with format yyyy-mm-dd
?
You can use "ddd MMM dd yyyy HH:mm:ss 'GMT'K"
format with DateTime.ParseExact
like;
string s = "Fri Nov 01 2013 00:00:00 GMT+0100";
DateTime dt = DateTime.ParseExact(s, "ddd MMM dd yyyy HH:mm:ss 'GMT'K", CultureInfo.InvariantCulture);
Console.WriteLine(dt);
Output will be;
10/31/2013 11:00:00 PM
Here a demonstration
.
For more informations, take a look at;
Custom Date and Time Format Strings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With