0

I am having problem to the footable because whenever i use the data-format-string in footable the output becomes the same.

 <table id="table" data-paging="true" data-sorting="true">
 <thead>
      <tr>
         <th data-name="date_from" data-type="date" data-format-string="MMM DD YYYY">Date</th>
         <th data-name="title">Title</th>
         <th data-name="venue">Venue</th>
        <th data-name="activity_id">View</th>
     </tr>
     </thead>
      <tbody>
        <?php
           $myqry=$db->prepare("SELECT activity_id,date_from,title,venue FROM activity" );
           $myqry->execute();
           $anotherarray=array();
           while($myqr=$myqry->fetch(PDO::FETCH_ASSOC)){
                 echo '<tr><td>'.$myqr['date_from'].'</td>
                 <td>'.$myqr['title'].'</td>
                 <td>'.$myqr['venue'].'</td>
                 <td><a href="view_act.php?actvid='.$myqr['activity_id'].'">View</a></td></tr>';
           }                              
       ?>
 </tbody>
 </table>

What I expect:

this is i expect to see in my date column

What I get:

this is what i get

Rich Churcher
  • 7,361
  • 3
  • 37
  • 60
RowRow
  • 11
  • 3
  • Welcome! You might want to include images that are mostly text as just text in the body of your post. Failing that, add an exclamation point in front of each of 'em `![description][1]` to make it easier for people to answer your question. Cheers! – Rich Churcher Dec 09 '17 at 01:41
  • oh okay, im just new here, thanks for the suggestion . however i cant post images due to the lack of reputation – RowRow Dec 09 '17 at 01:50
  • Ah, I see. I should be able to make it inline by editing :) – Rich Churcher Dec 09 '17 at 01:53
  • 1
    Wow! we can do that huh? Thank you :) – RowRow Dec 09 '17 at 02:00

1 Answers1

1

Solved this question. I converted my date using strtotime then multiplied it by 1 milliseconds. My reference was Pass Datetime/Timestamp from PHP to Javascript by echo the one that Travesty3 answered. This is my php code now

<?php
    $myqry=$db->prepare("SELECT activity_id,date_from,title,venue FROM activity" );
    $myqry->execute();
    while($myqr=$myqry->fetch(PDO::FETCH_ASSOC)){
      $mydate=strtotime($myqr['date_from'])*1000;
      echo '<tr><td data-value="'.$mydate.'"></td>
          <td>'.$myqr['title'].'</td>
          <td>'.$myqr['venue'].'</td>
          <td><a href="proc_view_act.php?actvid='.$myqr['activity_id'].'">View</a></td></tr>';
    }                            

?>

RowRow
  • 11
  • 3