JavaScript / GAS で日付操作
GAS で Gmail を操作続行中。 一日ごとのメールを取得したかったので、ある範囲(6月〜11月)の日付をなめる for 文を。 SpreadSheet に出力することを想定しているので、col に曜日をとり、1週間ごとに row をインクリメントしている。
date = new Date(2015, 5, 1); //6 月なことに注意 while(date.getMonth() < 11){ col = date.getDay()+1; date.setDate(date.getDate()+1); sheet.getRange(row, col).setValue(date); if(col==7){ row++; } }