title: format a JavaScript date using substring
body: <p>The below method sends date to text box in this format <code>Wed Sep 14 2016 00:00:00 GMT+0400</code>.
  So i tried to use substring method to get date in this format  <code>Sep 14 2016</code></p>
  
  <p>i have tried to it in below code but it didn't work</p>
  
  <p>it return this error <code>Uncaught TypeError: date.substring is not a function</code> </p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function () {
          var dateval = $('#&lt;%= txtdate.ClientID %&gt;').val();
          if (dateval != '') {
  
              var options = {
                  selectedDate: dateval,
                  size: 'medium',
                  width: 960
              }
          } else {
              var options = {
                  size: 'medium',
                  width: 960
              }
          }
          $('#paginator').datepaginator(options);
          $('#paginator').on('selectedDateChanged', function (event, date) {
              $('#&lt;%= txtdate.ClientID %&gt;').val(date.substring(4, 12));
          });
      });
  &lt;/script&gt;
  </code></pre>