Maison >développement back-end >tutoriel php >php 判断开始交易到现在时间的天数和判断超出指定天数
<table class="tablelist"> <thead> <tr> <th>提现用户</th> <th>金额</th> <th>状态</th> <th>开始交易时间</th> <td><strong>当前交易天数</strong></td> <td>当前已超出付款日期</td> </tr> </thead> <tbody> <foreach name='list' item='v'> <tr> <td>{$v.g_user} </td> <td>{$v.jb} </td> <td><if condition="$v.zt eq 0" >待付款</if> <if condition="$v.zt eq 1" >已付款</if> <if condition="$v.zt eq 2" >交易成功</if></td> <td>{$v.date}</td> <td><p>开始到目前的天数</p> <p>现在时间-开始日期{$v.date}=交易天数</p></td> <td>这里如果当前天数超出2天则显示“<span class="STYLE1">已超出</span>”</td> </tr> </foreach> </tbody> </table>
<script> <br /> <br /> function getDays(strDateStart,strDateEnd){ <br /> var strSeparator = "-"; //日期分隔符 <br /> var oDate1; <br /> var oDate2; <br /> var iDays; <br /> oDate1= strDateStart.split(strSeparator); <br /> oDate2= strDateEnd.split(strSeparator); <br /> var strDateS = new Date(oDate1[0], oDate1[1]-1, oDate1[2]); <br /> var strDateE = new Date(oDate2[0], oDate2[1]-1, oDate2[2]); <br /> iDays = parseInt(Math.abs(strDateS - strDateE ) / 1000 / 60 / 60 /24)//把相差的毫秒数转换为天数 <br /> return iDays ; <br />} <br /> <br /> <br />alert(getDays("2012-12-01","2012-12-25")); <br /> <br /> <br />或者说alert(getDays("2012-12-01","2012-12-25"));怎么把日期换成{$v.date} <br /> <br />alert(getDays("2012-12-01","{$v.date}")); 这样不行,获取不了 <br /> </script>
没人会吗?.....
$days = (int)((time()-strtotime($v.date))/(3600*24));
$days = (int)((time()-strtotime($v.date))/(3600*24));
$days = (int)((time()-strtotime($v.date))/(3600*24));
$days = (int)((time()-strtotime($v.date))/(3600*24));
$days = (int)((time()-strtotime($v.date))/(3600*24));
$days = (int)((time()-strtotime($v.date))/(3600*24));