title: compare two date using javascript
body: <p>I have two date in which one is <code>dd-mm-yyyy hh:mm</code> format and another in <code>dd-mm-yyyy (D1)</code> format
  fristly i split  the <code>dd-mm-yyyy hh:mm</code> format date to get <code>dd-mm-yyyy (D2)</code> format only
  then i compare the date D2 and D1 like</p>
  
  <pre><code>var D1 = new Date(); 
  var D2 = new Date(); 
  // D1 = 03-05-2014  this date take as an example
  // D2 = 28-04-2014 00:00  this date take as an example
  // D1 and D2 are taken by input fields.
      split the D2 date
  
  dat = D2.split(' ');
  D2 = dat[0];
  //finally D2 is 28-04-2014
  if(D2&lt;=D1)
  {
    echo "ok";
  }
  else{
    echo "something is wrong";
  }
  </code></pre>
  
  <p>I am always getting the else part, is this because i split the date from <code>28-04-2014 00:00</code> to <code>28-04-2014</code> ?</p>