title: add hours to new Date only showing NaN
body: <p>I know there are many questions like this when I googled it, and I cannot seem to make it work. I use Safari as my bowser, which is new to me since OS X Yosemite.  But, I cannot figure this one out.</p>
  
  <p>All I am trying to do, using Keith Wood countdown plugin, is get a datetime from a database and add 2 hours.  Here is the code:</p>
  
  <pre><code>$(data).each(function(key, value) {
  
      var box = '';
  
      box += '&lt;div class="outterBox" id="qBox'+value.qid+'" name="'+value.qid+'"&gt;'+value.question+'&lt;/div&gt;';
      box += '&lt;div id="timer'+value.qid+'"&gt;&lt;/div&gt;';
  
  
      var newYear = new Date(value.added);
      var endtime = newYear.setHours(newYear.getHours() + (2));
  
      console.log(value.added);
      console.log(endtime);
  
      $('#listQuestions').append(box);
      $('#timer'+value.qid).countdown({until: endtime});
  
  });
  </code></pre>
  
  <p>It seems pretty simple, I tried to make the new adjusted date (with the extra two hours) a new Date again, but that gave me the same problem.</p>
  
  <p>Here is the output in console: </p>
  
  <blockquote>
    <p>With console.log(new Date(endtime);</p>
    
    <p>2014-10-24 19:48:01</p>
    
    <p>Invalid Date</p>
    
    <p>2014-10-24 19:39:14</p>
    
    <p>Invalid Date</p>
    
    <p>2014-10-24 19:30:23</p>
    
    <p>Invalid Date</p>
  </blockquote>
  
  <p>and:</p>
  
  <blockquote>
    <p>With console.log(endtime):</p>
    
    <p>2014-10-24 19:56:14</p>
    
    <p>NaN</p>
    
    <p>22014-10-24 19:48:01</p>
    
    <p>NaN</p>
    
    <p>2014-10-24 19:39:14</p>
    
    <p>NaN</p>
    
    <p>2014-10-24 19:30:23</p>
    
    <p>NaN</p>
  </blockquote>
  
  <p>Worth noting I have tried many examples I have found with adding hours to dates, but none of them worked, so this example seems the most logical, but I am doing something stupidly wrong. Any ideas?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>With the help from below, I have some issues which perhaps I did not really make clear in my explaining.</p>
  
  <p>It looks like the date coming in from a cycle jquery(ajax)/php/database/php(echo)/jquery(ajax) looks like this:</p>
  
  <blockquote>
    <p>2014-10-24 19:30:23</p>
  </blockquote>
  
  <p>I do not think the above is a valid date, but a string. I think this because if I add this:</p>
  
  <pre><code>newYear = new Date(value.added);
  </code></pre>
  
  <p>I get <strong>Invalid Date</strong>. So any getHours() request cannot be evaluated, and so gives an error.</p>
  
  <p>I have tried breaking down the string, and recreate a new date like this:</p>
  
  <pre><code>var dt  = newYear.split(/\-|\s/);
  endDate = new Date(dt[2] + '/' + dt[1] + '/' + dt[0] + ' ' + dt[3]);
  console.log(endDate.getFullYear());
  </code></pre>
  
  <p>But the above gives me a <strong>NaN</strong>.</p>
  
  <p>The reason I think its a string is if i put the following code:</p>
  
  <pre><code>if(String(value.added)){
                  console.log('isString Date')
              } else {
                  console.log('is Not String Date')
              }
  </code></pre>
  
  <p>console prints <strong>isString Date</strong></p>
  
  <p>And this explains why the countdown works, but does not give an accurate time.  The database is mySQL.</p>
  
  <p>So is it because the time is being passed through php, and then JS, as the database is column is set to datetime ?</p>