I'm trying to save a date field in SQLSERVER database, but it does not insert, it is returning the following error:
String was not recognized as a valid DateTime.
DateTime dat = DateTime.ParseExact(txtVencimentoC.Text, "dd/MM/yyyy", null);
cadastrocontasreceber.Vencimento = dat;
I tried this way, and several others, but all of them return the error. As I am doing the sum of dates by javascript, the field is of this format "Sun Nov 19 2017 00:00:00 GMT-0200 (Brazilian Daylight Time)" How can I do it to format it to DateTime in SqlServer, or how can I configure it inside javascript by passing it to the already formatted CVTxt? For all forms give me the same error. Thanks.