strtotime():将任何字符串的日期时间描述解析为 Unix 时间戳
$date = array(
'当前'=>'2019-07-09',
'上一年'=>date( 'Y-m-d', strtotime('2019-07-09 -1 year') ),
'上一月'=>date( 'Y-m-d', strtotime('2019-07-09 -1 month') ),
'上一周'=>date( 'Y-m-d', strtotime('2019-07-09 -1 week') ),
'上一日'=>date( 'Y-m-d', strtotime('2019-07-09 -1 day') ),
'下一日'=>date( 'Y-m-d', strtotime('2019-07-09 +1 day') ),
'下一周'=>date( 'Y-m-d', strtotime('2019-07-09 +1 week') ),
'下一月'=>date( 'Y-m-d', strtotime('2019-07-09 +1 month') ),
'下一年'=>date( 'Y-m-d', strtotime('2019-07-09 +1 year') ),
);
输出
Array
(
[当前] => 2019-07-09
[上一年] => 2018-07-09
[上一月] => 2019-06-09
[上一周] => 2019-07-02
[上一日] => 2019-07-08
[下一日] => 2019-07-10
[下一周] => 2019-07-16
[下一月] => 2019-08-09
[下一年] => 2020-07-09
)
上一篇:
解决前端富文本不能显示
下一篇:
PHP动态修改配置文件,存储为文件
0人点赞