$date = date('Y-m-d', strtotime('-7 days')); //保留年-月-日 <?php echo echo date(”Y-m-d H:i:s”,strtotime(”-7 day”)) ;?> //保留年-月-日 时:分:秒 strtotime('-7 days') 获得的是时间戳 strtotime('now')); //获取当前的时间戳 time() //获取的时间戳 扩展资料: 一、使用函式 date() 实现 在编辑器中输入<?php echo $showtime=
...全文
使用如下代码即可: $date = date('Y-m-d', strtotime('-7 days'));date和strtotime是php中使用频率很高的时间函数,其中: date(string '格式', int 时间戳) 如果不提供时间戳表示当前时间。 strtotime(string '时间字符串'),将一个时间的描述转换为时间戳,如 '2015
...全文