Trying to add 1 to a Split String
<p>I'm trying to modify a retrieved date <code>ex: 2013-01-20 00:59:06</code> by adding <code>+1</code> to the day if the time is less than 20:00. The reason is that if the time retrieved is less than 20:00, it means that it must be then somewhere between 00:00 and 07:00 - meaning it's the next day.</p>

<p>Here is what I did:</p>

<pre><code>var WhenDateUnformatted = $('#when').val().split('/');
var startTimeSPLIT = startTime.split(':');

if (WhenDateUnformatted[1] &lt; 20) {
var WhenDateUnformatted[1] = WhenDateUnformatted[1] + 1;
}

var WhenDate = WhenDateUnformatted[2] + '-' + WhenDateUnformatted[0] + '-' + WhenDateUnformatted[1] + ' ' + startTime + ':00';
</code></pre>

<p>The error I receive is:</p>

<blockquote>
  <p>SyntaxError: missing ; before statement</p>
  
  <p>var WhenDateUnformatted[1] = WhenDateUnformatted[1] + 1;</p>
</blockquote>

<p>It doesn't like the <code>[1]</code></p>

<p>Does that mean I have to convert <code>WhenDateUnformatted[1]</code> to an individual variable first if I want to do anything with it?</p>

<p>Thanks! :)</p>

<p><strong>Edit:</strong> I made a mistake, the first part should be</p>

<pre><code>if (startTimeSPLIT[0] &lt; 20) {
</code></pre>
