datetime - .net: How to parse a date with this format: 08 Feb 2011 06:46 -


How do I use the date format: To parse the parameter, from time to time with the following format:

08 February 2011 06:46

In response to the reply I have received so far, I tried the following:

 < Code> item.ServerDate = DateTime Parsexact ("08 February 2011 06:46", "DD MMM Yay HH: MM", System Glossisation. CultureInfo.Invalian Culture);   

I still get the exception: string was not recognized as valid date time

Update: The following codes work without hours and minutes :

  datetime. Parascact ("08 February 2011", "DD MMM yyyy", blank)    

< Strike>

  DateTime.Presquelect ("08 February 2011 06:46", "DD MMM Yay HH: MM", System Glossisation.CalcherInfo.InVariantics);   

In the sample code of your question, you forgot to capitalize all months of "M"

Edit

As Anton points out, there is a need to capitalize "H" to use military time.

  DateTime Parascact ("08 Feb 2011 13:46", "DD Mmm Yay HH: mm", System.Globalization.CalcherInfo.Invalian Culture)   

The above code works for me I do not imagine Why can you get an error on the same code, when we are specifying the culture, can you double check your code and input?

Comments