title: Disable dates and time in a jquery time from mysql
body: <p><strong>Update</strong> This is a complete update to my question</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  
  &lt;meta charset="utf-8"&gt;
  
  &lt;meta name="author" content="Amsul - http://amsul.ca"&gt;
  &lt;meta name="viewport" content="width=device-width,user-scalable=no"&gt;
  &lt;meta http-equiv="cache-control" content="no-cache"&gt;
  &lt;meta http-equiv="pragma" content="no-cache"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=Edge"&gt;
  
  &lt;title&gt;Pickadate.js&lt;/title&gt;
  
  &lt;link rel="stylesheet" href="../../lib/themes/default.css"&gt;
  &lt;link rel="stylesheet" href="../../lib/themes/default.date.css"&gt;
  &lt;link rel="stylesheet" href="../../lib/themes/default.time.css"&gt;
  
  &lt;!--[if lt IE 9]&gt;
      &lt;script&gt;document.createElement('section')&lt;/script&gt;
      &lt;style type="text/css"&gt;
          .holder {
              position: relative;
              z-index: 10000;
          }
          .datepicker {
              display: block;
          }
      &lt;/style&gt;
  &lt;![endif]--&gt;
  
  
  &lt;body&gt;
  &lt;?php
  require 'connect-db.php';
  
     try{
      $stmt = $db-&gt;query("SELECT ddate FROM testdates");
  $result = $stmt-&gt;fetchAll(\PDO::FETCH_ASSOC);
  }catch(\PDOException $e){
      echo $e-&gt;getMessage();
  }
  
  $json_array = json_encode($result)
  
     ?&gt;
  
  
  
  
      &lt;section class="section"&gt;
  
          &lt;form&gt;
              &lt;fieldset&gt;
                  &lt;h3&gt;&lt;label for="datepicker_id"&gt;Pick a date.&lt;/label&gt;&lt;/h3&gt;
  
                  &lt;input
                      id="datepicker_id"
                      class="datepicker"
                      name="date"
                      type="text"
                      value=""
                      data-value=""&gt;
  
                  &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
  
  
                  &lt;h3&gt;&lt;label for="timepicker_id"&gt;Pick a time&lt;/label&gt;&lt;/h3&gt;
                  &lt;input
                      id="timepicker_id"
                      class="timepicker"
                      value=""
                      type="time"
                      name="time"&gt;
                      &lt;!-- valuee="2:30 AM"
                      data-value="0:00" --&gt;
  
                  &lt;!-- &lt;button type="button"&gt;Disable all dates&lt;/button&gt;
                  &lt;input class="button" type="submit" value="open"&gt; --&gt;
              &lt;/fieldset&gt;
          &lt;/form&gt;
  
  
          &lt;div id="container"&gt;&lt;/div&gt;
  
  
  
      &lt;/section&gt;
  
  
      &lt;script src="../jquery.1.9.1.js"&gt;&lt;/script&gt;
      &lt;script src="../../lib/picker.js"&gt;&lt;/script&gt;
      &lt;script src="../../lib/picker.date.js"&gt;&lt;/script&gt;
      &lt;script src="../../lib/picker.time.js"&gt;&lt;/script&gt;
      &lt;script src="../../lib/legacy.js"&gt;&lt;/script&gt;
  
  
  
      &lt;script type="text/javascript"&gt;
      //datepicker
       var disdates = &lt;?php echo $json_array; ?&gt;
  
  
          var $input = $( '.datepicker' ).pickadate({
              formatSubmit: 'yyyy/mm/dd',
               min: true,
              container: '#container',
              // editable: true,
              closeOnSelect: true,
              closeOnClear: false,
                disable: [ disdates
  
    ]
  
          })
  
  
  
  
  
          var picker = $input.pickadate('picker')
  
  
  
  
          // picker.set('select', '14 October, 2014')
          // picker.open()
  
          // $('button').on('click', function() {
          //     picker.set('disable', true);
          // });
  
      &lt;/script&gt;
  
  
  
  &lt;script type="text/javascript"&gt;
  //timepicker
  
          var dtimes = new Date(2015,11,28,5,30);
          var $timeinput = $( '.timepicker' ).pickatime({
              disable: [
      [2,0],
      dtimes
  
  
      ]
  
  
          })
          var timepicker = $timeinput.pickatime('picker')
  
      &lt;/script&gt;
  
  
  
  &lt;/body&gt;
  &lt;/html&gt; // i must thank users in php chatroom for helping me fix the errors.
  </code></pre>
  
  <p>That above, is a page where you see a calendar, and some dates are disabled, which are fetched from the database. I'm using <a href="http://amsul.ca/pickadate.js/date/#disable-dates-use-arrays" rel="nofollow">this picker</a></p>
  
  <pre><code>  disable: [
      [2015,29,9], // disables today strangely month -1 and only accepts yyy,mm,dd
      [some other array]
  
    ]
  })
  </code></pre>
  
  <p>In my databese 'ddate' is varchar, no primary key, no unique id, nothing, containing</p>
  
  <pre><code>2015,9,30   
  2015,9,31   
  2015,10,30  
  </code></pre>
  
  <ol>
  <li><p>the values aren't being passed or something from mysql to javascript or something, and i guess i want multidimentional array.</p></li>
  <li><p>what i want the javascript array to have is month -1 because as I explained above, in disable option to disable this day, you have to enter last month number. and if first month, means 12.</p></li>
  </ol>
  
  <p>Note I want to use the same for <a href="http://amsul.ca/pickadate.js/time/" rel="nofollow">timepicker</a> but I guess I could do on my own if I understand the issue with calendar</p>