我发布的文章有个创建时间字段,如何计算距离当前时间有几天?
查看更多
时间差的2个方式方式1:$d1 =date_create(date('Ymd',time())); $d2 = date_create(date('Ymd',$archives['publishtime'])); $d = date_diff( $d1 ,$d2);echo $interval->format('%R%a 天');
方式2:time()-$archives['publishtime']如果求相差多少天round((time()-$archives['publishtime'])/86400);
发布 问题
分享 好友
手机 浏览
回到 顶部