5
I am trying to subtract a date that the user type in the input with the current date.
var data1 = $("#data_viagem").val();
var data1 = data1.split("/");
var viagem = new Date(data1[2], data1[1], data1[0]);
var dateObj = new Date();
var month = dateObj.getUTCMonth() + 1; //months from 1-12
var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear();
I set up these two blocks to assemble the two dates, but I can’t get past here. I am unable to mount the current date to make a valid subtraction. I get wrong results.
You want to calculate the difference?!
– viana
Yes. The difference in days.
– lufizi