doujian1954 2017-12-09 01:23
浏览 102

使用fooTable中的formatString,PHP日期输出是相同的

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

  • 写回答

1条回答 默认 最新

  • donglei_0507 2017-12-10 08:52
    关注

    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>';
        }                            
    

    ?>

    评论

报告相同问题?

悬赏问题

  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测