Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
日付を入力する入力テキスト ボックスがあり、入力日から 6 か月を計算する方法が必要です。 入力日付形式は次のとおりです。
dd/mm/yy
どのように機能するかの例: 入力日付:01/07/13 関数からの出力は次のようになります:01/01/14
01/07/13
01/01/14
あなたが持っている場合Date:
Date
var date = new Date(year, month, day);
6 か月後に取得するには、次を使用します。
date.setMonth(date.getMonth() + 6);
デモ: http://jsfiddle.net/GF6B6/