title: DataTable formatting datetime column in table
body: <p>I am using the DataTable plugin to display a mySQL database table in a dynamic way. The table uses the datetime format for the column "checkinDateTime". In my table, it formats the date/time as <code>2016-04-15 14:27:36</code>. I would like to make this more readable, possibly formatted like <code>April 15, 2016, 2:27 pm</code></p>
  
  <p>Here is my code:</p>
  
  <p>Reports.php (this is where the user can view the table. I'm only going to show the DataTables script and its settings):</p>
  
  <pre><code>&lt;script&gt;
      $(document).ready(function() {
  
          $('#checkin').DataTable({
          "bProcessing": true,
          "serverSide": false,
          "dom": 'lBfrtip',
       "buttons": [
          {
              extend: 'collection',
              text: 'Export',
              buttons: [
                  'copy',
                  'excel',
                  'csv',
                  'pdf',
                  'print'
              ]
          }
      ],
          "ajax":{
              url :"response.php", // json datasource
              type: "post",  // type of method  ,GET/POST/DELETE
              data: {}
              }
          });   
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>Response.php (how DataTables pulls in the data):</p>
  
  <pre><code>&lt;?php
  //include connection file 
  include_once("../connection.php");
  
  // initilize all variable
  $params = $columns = $totalRecords = $data = array();
  
  $params = $_REQUEST;
  
  //define index of column
  $columns = array( 
  0 =&gt; 'id',
  1 =&gt; 'suid', 
  2 =&gt; 'staffMember',
  3 =&gt; 'studentName',
  4 =&gt; 'studentEmail',
  5 =&gt; 'checkinDateTime'
  );
  
  $where = $sqlTot = $sqlRec = "";
  
  // check search value exist
  if( !empty($params['search']['value']) ) {   
  $where .=" WHERE ";
  $where .=" ( studentName LIKE '".$params['search']['value']."%' ";    
  $where .=" OR staffMember LIKE '".$params['search']['value']."%' ";
  $where .=" OR studentEmail LIKE '".$params['search']['value']."%' ";
  $where .=" OR suid LIKE '".$params['search']['value']."%' ";
  $where .=" OR checkinDate LIKE '".$params['search']['value']."%' )";
  }
  
  // getting total number records without any search
  $sql = "SELECT * FROM `checkin` ";
  $sqlTot .= $sql;
  $sqlRec .= $sql;
  //concatenate search sql if value exist
  if(isset($where) &amp;&amp; $where != '') {
  
  $sqlTot .= $where;
  $sqlRec .= $where;
  }
  
  
  //$sqlRec .=  " ORDER BY ". $columns[$params['order'][0]['column']]."   ".$params['order'][0]['dir']."  LIMIT ".$params['start']." ,".$params['length']." ";
  
  $queryTot = mysqli_query($VisitorManagement, $sqlTot) or die("database error:". mysqli_error($VisitorManagement));
  
  
  $totalRecords = mysqli_num_rows($queryTot);
  
  $queryRecords = mysqli_query($VisitorManagement, $sqlRec) or die("error to fetch check-in data");
  
  //iterate on results row and create new index array of data
  while( $row = mysqli_fetch_row($queryRecords) ) { 
  $data[] = $row;
  }   
  
  $json_data = array(
      "draw"            =&gt; intval( $params['draw'] ),   
      "recordsTotal"    =&gt; intval( $totalRecords ),  
      "recordsFiltered" =&gt; intval($totalRecords),
      "data"            =&gt; $data   // total data array
      );
  
  echo json_encode($json_data);  // send data as json format
  ?&gt;
  </code></pre>
  
  <p>Connection.php (access to the database):</p>
  
  <pre><code>&lt;?php
  $hostname_VisitorManagement = "localhost";
  $database_VisitorManagement = "visitor-management";
  $username_VisitorManagement = "****";
  $password_VisitorManagement = "****";
  $VisitorManagement = mysqli_connect($hostname_VisitorManagement, $username_VisitorManagement, $password_VisitorManagement, $database_VisitorManagement);
  
  if (mysqli_connect_errno()) {
  printf("Connect failed: %s\n", mysqli_connect_error());
  exit();
  }
  
  date_default_timezone_set('America/New_York');
  ?&gt;
  </code></pre>
  
  <p>I have looked through their support forums and on here as well, but I didn't find a solution that could work with my code. </p>