Author: clubnp | Posted on: 9/11/2010 2:38:32 PM | Views : 254

Hello, I am trying to figure out the best way to convert a string object into a DateTime with only using the year.
I have something like:


Date Time HSYear = DateTime.ParseExact(HighSchoolyear, "yyyy", System.Globalization.CultureInfo.CurrentCulture);

But it is still giving a "String was not a recognized as a valid DateTime."


In the full context, I have a webpage with a formview on it and within the formview is a TextBox control that is taking a user input such as "1999"  then an ObjectDataSource picks it up and runs it through a BLL. And within the BLL is where I am trying to convert it before it gets inserted into the database.



...

Go to the complete details ...