Conversion from date javascript to sqlserver

0

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.

    
asked by anonymous 17.10.2017 / 21:54

1 answer

0

I've used this link as a reference. It looks like this in the code:

document.getElementById("<%= txtVencimentoC.ClientID %>").value = data.format("dd/MM/yyyy HH:mm:ss");
    
18.10.2017 / 13:07