php获取当天零点的时间昨日时间的零点,并统计用户数


 thinkphp5.1 中 wheretime() 方法使用

$todaytime=date('Y-m-d H:i:s',strtotime(date("Y-m-d"),time()));//今天零点 $oldtoday=date('Y-m-d H:i:s',strtotime($todaytime)-86400);//昨日零点
//今日粉丝数量
$fans[fans1]=Db::name('WechatFans')->whereTime('subscribe_at', '>=', $todaytime)->count();
//昨日粉丝数量
$fans[fans2]=Db::name('WechatFans')->whereTime('subscribe_at', 'between', [$oldtoday,$todaytime])->count();

$this->assign('fans',$fans);
$this->fetch();

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM