【发布时间】:2012-05-29 11:27:50
【问题描述】:
我正在尝试使用 PHP 的日期函数以 YYYY-MM-DD 格式获取 7 天前的日期。
date('Y-m-d');
当我尝试时
date('Y-m-d-7');
我得到一个错误
【问题讨论】:
-
使用
date('Y-m-d', strtodate('-7 days')) -
@Gavin 调用未定义函数 strtodate()
-
函数是
strtotime。 -
道歉,很好,
date('Y-m-d', strtotime('-7 days'))