0

I want to sum up timepicker's value with datetimepicker's value with javascript. So date + time? How can we do it?

 var datetime = $("#appoimentDate").val();
 var time = $("#timepicker").val();

result;

date = "26.03.2018 08:15:00" ,
time = "2:00"

result = 26.03.2018 10:15:00

How can I make the result output correctly?

yuksel
  • 71
  • 1
  • 13
  • 2
    Possible duplicate of [Adding hours to Javascript Date object?](https://stackoverflow.com/questions/1050720/adding-hours-to-javascript-date-object) – u_mulder Mar 25 '18 at 10:42
  • You don't say what libraries you are using but `.val()` suggests [jQuery](http://api.jquery.com/val/#val) so you have plain strings. You first need to parse that into a proper `Date`. – Álvaro González Mar 25 '18 at 11:53

0 Answers0