title: How may I return a date in format YYYYMMDD using JQuery DatePicker?
body: <p>I'm trying to implement the <a href="https://jqueryui.com/datepicker/#show-week" rel="nofollow">JQuery DatePicker w/ week no</a> and returning the selected date in format YYYYMMDD. When looking into the <a href="http://api.jqueryui.com/datepicker/#option-dateFormat" rel="nofollow">api for how to format date</a> it says this could be done by using dateFormat: "yy-mm-dd". However, I'm not able to return the date in specified format. </p>
  
  <p>I'm able to return the date in 'original format' with this code:</p>
  
  <pre><code>$(function DatePicker() {
  $( "#datepicker" ).datepicker({
      onSelect: function(date)    {
      var date = $(this).datepicker( 'getDate' );
      alert(date);
  ( 'getDate' ).getDate();
      },      
      showWeek: true,
      //showOn:"button",
      firstDay: 1
   });
  });
  </code></pre>
  
  <p>Here is my code for trying to return (show a pop up) wewith the format 'YYYYMMDD':</p>
  
  <pre><code>$(function DatePicker() {
  $( "#datepicker" ).datepicker({
  //  dateFormat: 'yy-mm-dd',
      onSelect: function()    {
          dateFormat: 'yy-mm-dd',
          //var dateFormat = $(this).datepicker( "option", "dateFormat" );
          //$.(this).datepicker("option", "dateFormat", "yy-mm-dd"); //Senast insatt
          alert(dateFormat);
      },      
      showWeek: true,
      firstDay: 1
  });
  </code></pre>
  
  <p>});</p>
  
  <p>Obviously I'm new to JQuery, and fairly new to JavaScript as a language.</p>
  
  <p>Thanks!</p>