Issue comparing string with datetime in javascript
<p>script is ---</p>

<pre><code> function TimeSpentForFutureDate() {
      var toDate = new Date();
      toDate.setMinutes(0);
      toDate.setSeconds(0);
      toDate.setHours(0);
      toDate.setMilliseconds(0);
  //Here after selecting future date also, this condition is failing.The textbox
      // containing a future date

      if (document.getElementById('&lt;%= txtDate.ClientID%&gt;').value &gt; toDate) {
          var timespent = jPrompt('Enter Time Spent:', '', 'Enter Time Spent', 
          function (r) {
              if (r) {
                 document.getElementById('&lt;%= 
                    hiddenFieldFutureDateSelectTimeSpent.ClientID%&gt;').value = r;
                 jAlert('You entered ' + r);
              }
              else {
                 var todaysDate = new Date();
                 jAlert('You had not entered the Time Spent', 'Message');
              }
              });
            }
            else {
                document.getElementById('&lt;%=
                    hiddenFieldFutureDateSelectTimeSpent.ClientID%&gt;').value = 
                    timespent;
                document.getElementById('&lt;%= txtDate.ClientID%&gt;').value = toDate;
            }
        }
</code></pre>

<p>In the above code I'm checking that if text box 'txtDate' will contain a future date.</p>

<p>[ i.e date greater then today's date it will prompt for entering time spent and then store that time spent into an hidden field.]</p>

<p>I'm not able to convert a string into date time object for comparison. Please help me to resolve this issue.</p>

<p>Thanks in advance.</p>
