i am trying to convert a string in the format dd-mm-yyyy into a date object in JavaScript using the following:
var from = $(\"#datepicker\").val(); var to
In my case
new Date("20151102034013".replace(/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/, "$1-$2-$3T$4:$5:$6"))
Result: Mon Nov 02 2015 04:40:13 GMT+0100 (CET) then I use .getTime() to work with milliseconds