title: jquery date picker set date format as 'MM-DD-YYYY' from a string containing datetime
body: <p>I am trying to set the jquery datepicker date format but it is not working, I have read few posts and answer already but none of them worked for me. Below is the code I am using please check and tell me where I am doing wrong. I am getting the datetime from Database as <code>2012-03-06 00:00:00 UTC</code></p>
  
  <pre><code>&lt;script&gt;
          $(document).ready(function() {
              $(".datepicker").datepicker({
                  dateFormat:'MM-DD-YYYY'
              }).val();
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>Also I tried </p>
  
  <pre><code>&lt;script&gt;
          $(document).ready(function() {
              var dateTypeVar = $('.datepicker').datepicker('getDate');
              $.datepicker.formatDate('dd-mm-yy', dateTypeVar);
          });
      &lt;/script&gt;
  </code></pre>