title: Google Apps Script: Can't figure out how to add 7 days to a date
body: <p>I know this question has been asked many times but I still can't figure this out.  I am trying to add 7 days to a day.</p>
  
  <p>I found an example <a href="http://productforums.google.com/forum/#!topic/apps-script/S3O_jioT96A" rel="nofollow">here:</a></p>
  
  <p>This works and adds one day to the date as I'd expect: </p>
  
  <pre><code> var d = new Date(dateRange[11]);
   d.setDate(d.getDate()+1);
  </code></pre>
  
  <p>But when I try to do the same thing with dates that I have in an array (I will eventually iterate through this):</p>
  
  <pre><code>newDates[12] = new Date(newDates[11]);
  newDates[12].setDate(newDates[11].getDate()+7);
  </code></pre>
  
  <p>I am getting this error message:</p>
  
  <pre><code>TypeError: Cannot find function getDate in object Mon Jul 01 2013 00:00:00 GMT-0600 (MDT). 
  </code></pre>
  
  <p>When I debug, the type of each item in the array is 'Array' not date.  The data in each array item looks like this in the debugger: [(new Date(1372658400000))]  I am assuming that to use the getDate function this needs to be a date rather than an array item.  When I expand the array item, the item nested inside, so item [12][0] is a date.  Do I have to reference it differently?  </p>
  
  <p>Following that line of reasoning, I tried this:</p>
  
  <pre><code>newDates[12][0] = new Date(newDates[11][0]);
  newDates[12][0].setDate(newDates[11][0].getDate()+7);
  </code></pre>
  
  <p>But on the first line of that code above, I get this error: </p>
  
  <pre><code>TypeError: Cannot set property "0.0" of undefined to "(class)@1176d9d1". 
  </code></pre>
  
  <p>Does anyone have any suggestions on how I might get this to work?  Thanks!</p>