Hi guys,
i have an asp.net web application in which i have a page where i have date textbox,
whenever i'm trying to convert the textbox text to datetime, its throwing error,
Error
for hijri date, error: String was not recognized as a valid DateTime.
for grogorian date error: The Date Time represented by the string is not supported in calendar System.Globalization.GregorianCalendar.
*Not able to convert any date.
What I have tried:
Convert.ToDateTime(txtDOB.Text, CultureInfo.GetCultureInfo("en-US").DateTimeFormat);
When i have bind the textbox on pageload
textbox.text = DateTime.Now.ToShortDateString();
then, i'm getting here is, hijri date.
Error:
SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.
Conversion:
Convert.ToDateTime(txtDOB.Text, CultureInfo.GetCultureInfo("ar-SA").DateTimeFormat);
Can anyone please help me, how to solve this.
Thanks