簡単なJavaScript日付計算アルゴリズム
729 ワード
<br>var today=new Date(); //
<br>var year = today.getYear(); //
<br>var month = today.getMonth(); //
<br>var date = today.getDate(); //
<br>try{
<br>// , 30
<br>var nextDay = new Date(year,month,date+30);
<br>//
<br>document.write(nextDay.getYear(),'<br>');
<br>document.write(nextDay.getMonth()+1,'<br>');
<br>document.write(nextDay.getDate(),'<br>');
<br>}catch(e){
<br>alert(e.message);
<br>}
<br>
実行結果:2009
10
11