forum

Home / DeveloperSection / Forums / Converting a year string to a Datetime value

Converting a year string to a Datetime value

Anonymous User 1602 17-Nov-2014
I am creating a simple input form to create an account. On the form there is an input field for the year the company was founded, this is a simple textbox where the user will type in the year

However on attempting to insert this to the database field which is a datetime an error is being thrown despite converting the textbox entry to datetime...

 

myCompanyAccount.Founded = Convert.ToDateTime(this.TxtCompanyFounded.Text);

Is there a way in which i can can convert a year input  to a datetime so it can be inserted to the database...? Thanks in advance! 

Updated on 17-Nov-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By