title: Why isn't my javascript countdown working?
body: <p>I'm having a problem with a countdown i'm making for a webapp in javascript. The page has an input that's a calendar, that will provide the date to the countdown and it has the countdown itself!</p>
  
  <p>My problem is that i can't put the date provided by the calendar to work in the countdown.</p>
  
  <p>The time in the countdown has to be provided in seconds so, here's my code:</p>
  
  <p>The calendar input:</p>
  
  <pre><code>&lt;form style="margin-top:10px;"&gt;&lt;input id="date" class="tcal"&gt;&lt;/form&gt; 
  </code></pre>
  
  <p>the script to convert the date in seconds:</p>
  
  <pre><code>var target_date = document.getElementById('date').value;
  var target_date_secs = target_date.getTime();
  var target_date_in_secs = target_date_secs / 1000;
  var today = new Date();
  var today_secs = today.getTime();
  var today_in_secs = today_secs / 1000;
  var final_time_secs = target_date_in_secs - today_in_secs;
  document.write(final_time_secs);
  </code></pre>
  
  <p>and the problem is that this doesn't print anything, when it should print the time left in seconds...</p>
  
  <p>Any help would be great!</p>
  
  <p>Thanks!</p>