title: How to change date format of datepicker value in javascript
body: <p>I gone to many of the questions already asked in stackoverflow related to my problem, but i still i can't find any solution. I am trying to get the value from datpicker in my javascript function, but not able to change its format. By default its showing in mm/dd/yy format and i want in yyyy-mm-dd format. Can anyone please help.</p>
  
  <p>Below is my html code :</p>
  
  <pre><code>    &lt;html xmlns:h="http://xmlns.jcp.org/jsf/html"&gt;
      &lt;h:head&gt;
      &lt;script&gt;
          function getdate()
          {
           alert("Entered function");
        var date = $('#fromdate').val();
            $.datepicker.formatDate( 'yy-mm-dd' ,date );
              alert(date); }
          &lt;/script&gt;
       &lt;/h:head&gt;
      &lt;body&gt;
        &lt;input type="text" id="fromdate" class="form-control dpd1" name="from"placeholder="Select From Date"&gt;&lt;/input&gt;
        &lt;span class="input-group-addon"&gt;To&lt;/span&gt;
        &lt;input type="text" id="todate" class="form-control dpd2" name="to" placeholder="Select To Date" &gt;&lt;/input&gt;
        &lt;input type="button" onclick="getdate()" value="Change Date"&gt;&lt;/input&gt;
  
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>Thanks in advance.</p>