I have 2 <input type="text"> tags and I enter dates in them like this 22-05-2013
I want to subtract 22-06-2012 from that date
How do I do this?
I've tried this code but it didn't work:
function returnDate(nDays){
  var now = new Date();
  var dayOfTheWeek = now.getDay();
  now.setTime(now.getTime() - nDays * 24 * 60 * 60 * 1000);
  alert(now);  // returns current date
  alert(now.getFullYear() + "/"+(now.getMonth()+1)+"/"+now.getDate()) // returns new calculated date
}
So I need the difference between 22-05-2013 and 22-06-2012
 
     
     
     
     
    