title: Google scripts copy range from one spreadsheet to another based on date
body: <p>I am currently trying to automatically archive responses from a Google form. I have a script which runs every time the form is submitted and does some processing of the last submit. <br>
  What I want to do is on the first submit of the month, create a separate spreadsheet with just last months entries.<br>
  I am doing this by getting the date from last month, creating a new spreadsheet with last months name and year as the name of the file. <br><br></p>
  
  <p>What I now need to do is select a range based on dates. So in column A is a timestamp <em>(e.g. 31/12/2014 22:21:31)</em> - I would want to select all rows between for example <strong>1/12/2014 00:00:00</strong> and <strong>31/12/2014 23:59:59</strong>.</p>
  
  <p>Using this <a href="https://stackoverflow.com/a/17144704/232565">example</a> I know its possible to copy a range but it's finding the correct range I need help with:</p>
  
  <pre><code>  var ss = SpreadsheetApp.getActiveSpreadsheet();
    var target = SpreadsheetApp.openById("0Aqv8.....");
    var source_sheet = ss.getSheetByName("Form Responses");
    var target_sheet = target.getSheetByName("Sheet1");
    var source_range = source_sheet.getRange("A2:A");
    var target_range = target_sheet.getRange("A2:A");
  
    var values = source_range.getValues();
    target_range.setValues(values);
  </code></pre>
  
  <p>I am using the following to get the start time, and end time of the month:</p>
  
  <pre><code>  var x = new Date();
    var d = new Date();
  
    // Start Time:
    x.setDate(1);
    x.setHours(0);
    x.setMinutes(0);
    x.setSeconds(0);
    x.setMonth(x.getMonth()-1);
  
    // Finish Time:
    d.setDate(0);
    d.setHours(23);
    d.setMinutes(59);
    d.setSeconds(59);
  </code></pre>