title: Bootstrap datepicker -- how to get date as a string in the right format?
body: <p>I'm using <a href="https://github.com/eternicode/bootstrap-datepicker" rel="noreferrer">Bootstrap datepicker</a>. The answer is probably obvious, but I can't figure out how to get the selected date as a string in the specified format. I used:</p>
  
  <pre><code>&lt;div id="myDate" data-date-format="yyyy-mm-dd"&gt;
    &lt;input type="text"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And in my javascript:</p>
  
  <pre><code>var value = $("#myDate").datepicker("getDate");
  </code></pre>
  
  <p>But it returns a date, not a string in yyyy-mm-dd format.</p>