title: Convert HTML Date to Mysql Format
body: <p>I am using a bootstrapdatetimepicker as well as moment.js</p>
  
  <p>When i call the following</p>
  
  <pre><code>var starteventtime= ($('#startdatetime').data('DateTimePicker').date());
  </code></pre>
  
  <p>I get a date similar to </p>
  
  <pre><code>Wed Mar 27 2019 00:00:00 GMT+0000
  </code></pre>
  
  <p>I also have the option for the user to save their own format of the date. So any code will have to take this into consideration.</p>
  
  <pre><code>&lt;?php
     $datetimeformat = 'DD/MM/YYYY HH:mm';
   ?&gt;
      $(function() {
               $('#startdatetime').datetimepicker({
               format: '&lt;?php echo $datetimeformat; ?&gt;'
      });
  </code></pre>
  
  <p>How do i parse this on the client side with javascript to get Mysql formatted date so when the data is serialized it will be in a format ready for insertion into the database like below</p>
  
  <pre><code>2019-03-27 00:00:00
  </code></pre>