what happens is that I have this a date type input, what I want to do is insert this date that comes to me like this from the sql server database "2018-03-31 00:00:00"
and I want to be able to put it inside the input.
var date = "2018-03-31 00:00:00";
var fecha =new Date(date);
$("#fecha").val(fecha);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="date" id= "fecha">
I have tried the example above but I don't know what it could be, or maybe there is another way.
Hello! I've tried your code, and it seems to me that the input type date receives a string for value, not a Date() object. At least I tried it like this, and it worked O_o:
*Note that the time segment should not go, only the date. **I tried it with basic JS, but using JQuery it should be the same...