2 つ<input type="text">
のタグがあり、このように日付を入力します22-05-2013
22-06-2012
その日付から減算したい
どうすればいいですか?
このコードを試しましたが、うまくいきませんでした:
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
}
22-05-2013
だから私はとの違いが必要です22-06-2012