How can I convert a textbox string to datetime in asp.net c# ?
I tried this:
DateTime d2 = Convert.ToDateTime(tbx_Created.Text);
string createdformatted = d2.ToString("MM/dd/yyyy hh:mm:ss tt");
DateTime CreatdDate = DateTime.ParseExact(tbx_Created.Text, "MM/dd/yyyy hh:mm:ss tt", System.Globalization.CultureInfo.InvariantCulture);
but it shows this error:
String was not recognized as a valid DateTime
I have given 15-6-2016 to textbox.
Please advise.