String was not recognized as a valid DateTime.

String was not recognized as a valid DateTime in asp.net.

String was not recognized as a valid DateTime in c#.

Using DateTime.ParseExact.

string strDate ="10/12/2012";

DateTime date = DateTime.ParseExact(strDate, "dd/MM/yyyy", null);

About the Author

avatar