title: The simplest way of check if a data type of an element in an array is a date object?
body: <p>I want to create a condition that checks if a data type of an element in an array (formed by data from a spreadsheet) is a date object (so, I can manipulate the string format of this date, because I don't want a date like this:  <code>Thu May 23 2013 00:00:00 GMT-0400 (EDT)</code> but like this: <code>23/05/2013</code>).</p>
  
  <p>I get the date from the google spreadsheet using this function:</p>
  
  <pre><code>function getRowAsArray(sheet, row) {
    var dataRange = sheet.getRange(row, 1, 1, 99);
    var data = dataRange.getValues();
    var columns = [];
    for (i in data) {
      var row = data[i];
      Logger.log("Got row", row);
      for(var l=0; l&lt;16; l++) {
          var col = row[l];
          columns.push(col);
      }
    }
    return columns;
  }
  </code></pre>
  
  <p>Supose my data type object can be in one of the <code>data[i]</code> array elements. What is simplest way of doing it? </p>
  
  <pre><code>var text = data[i];
  </code></pre>
  
  <p>Supose my data type object can be in one of the  <code>data[i]</code> array elements. What is simplest way of doing it?
  It was sugested in one awnswer to do something like this</p>
  
  <pre><code> var data = getRowAsArray(sheet, sheet);
      for(var i=0; i&lt;columns.length; i++) {
      var key = ":" + columns[i] + ":";
  
      if (data[i] instanceof Date) {
          var d = data[i]; //date from data[i]
          var m = d.getMonth() + 1; //months starts at 0
          var y = d.getFullYear();
          var day = d.getDate();
          data[i] = day + "/" + m + "/" +y;
      }          
  </code></pre>
  
  <p>Thanks for any help!</p>