title: How to get the date on a datepicker?
body: <p>I am really new to javascript and jquery. I wanted to get the value of the date selected by the user via datepicker, and use the value in my javascript. The name of my datepicker is birthDate. This is my html code for the date picker:</p>
  
  <pre><code>       &lt;guis:datePicker required="true" label="Birthdate"
             bean="${accountInfo}" field="birthDate"
             value="${accountInfo?.birthDate?:"none"}"
             noSelection="${['null':'']}"/&gt; 
  </code></pre>
  
  <p>My javascript is:</p>
  
  <pre><code>            &lt;script type="text/javascript"&gt;                      
                  function isOfLegalAge() {    
                    var currDate = new Date();
                    var birthDate = $("#datepicker").val();  
                    var diff = currDate - birthDate
                    alert (currDate);
                    alert(birthDate);                      
                        if(diff &gt;= 18){
                            return true;                              
                        }else {                         
                            alert("You must be atleast 18 years old to register!");
                            document.location.href = '/user';
                            return false;                          
                        }
                        return true;
                  }
             &lt;/script&gt;
  </code></pre>
  
  <p>The value returned by the datepicker is in this format:</p>
  
  <p>Wed Jun 13 00:00:00 PHT 1990</p>
  
  <p>..while the new Date is: </p>
  
  <p>Wed Jun 06 2012 17:08:52 GMT+0800 (PHT)</p>
  
  <p>Please help!</p>
  
  <p>Thanks!</p>