title: jQuery Datepicker - How can I format the date as an epoch timestamp (in seconds NOT milliseconds)
body: <p>I'm using the jquery datepicker plugin to set a date field that is stored as an epoch timestamp in the db (the field, publish_time, maps directly to the table schema).</p>
  
  <p>It seems that Datepicker only supports epoch in milliseconds, and not seconds. Its aggravating that it supports milli &amp; nano seconds, but not seconds.</p>
  
  <p>Are there any quick workarounds?</p>
  
  <pre><code>// Setup datepicker
  $('[name=datepicker-publish_time]').datepicker({
      dateFormat : 'mm-dd-yy',
      altField : '[name=publish_time]',
       altFormat : '@'
  });
  </code></pre>
  
  <p>References:<br>
  jQuery Datepicker - <a href="http://jqueryui.com/demos/datepicker/#option-defaultDate" rel="noreferrer">http://jqueryui.com/demos/datepicker/#option-defaultDate</a><br>
  jQuery Support Date Formats - <a href="http://docs.jquery.com/UI/Datepicker/formatDate" rel="noreferrer">http://docs.jquery.com/UI/Datepicker/formatDate</a></p>
  
  <p>Edit: Below is a quick dirty solution...</p>
  
  <pre><code>$('[name=datepicker-publish_time]').datepicker({
      dateFormat : 'mm-dd-yy',
      onSelect : function(dateText, inst)
      {
          var epoch = $.datepicker.formatDate('@', $(this).datepicker('getDate')) / 1000;
  
          $('[name=publish_time]').val(epoch);
      }
  });
  </code></pre>