How to convert php timestamp to days: First create a PHP sample file; then convert the timestamp to days through "(time()-$v['createtime'])/86400;" .
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
php timestamp is converted into days and rounded to an integer
public function edit() { global $_W; global $_GPC; $openid=$_W['openid']; $boards = pdo_fetchall('select b.id,b.logo,b.title,f.createtime from ' . tablename('ewei_shop_sns_board_follow') . ' f ' . ' left join ' . tablename('ewei_shop_sns_board') . ' b on f.bid = b.id ' . ' where f.uniacid=:uniacid and f.openid=:openid ', array(':uniacid' => $_W['uniacid'], ':openid' => $openid)); $boards = set_medias($boards, 'logo'); include $this->template(); } //html 代码{loop $boards $k $v}{/loop}{$v['title']}已坚持 "; if( $times<1){ echo "1"; }else{ echo round("$times"); } ?> 天
Key points
{$v['title']} =
The round() function rounds floating point numbers.
Example
Output:
1 1 0 -4 -5
[Recommended learning:PHP video tutorial]
The above is the detailed content of How to convert timestamp in php to days. For more information, please follow other related articles on the PHP Chinese website!