php获取前一小时、前一天、三天前、前一个月、三个月前、前一年的时间

左心房为你撑大大i 提交于 2019-12-05 16:31:13

php获取前一个小时的时间:

$mtime= date("Y-m-d H:i:s", strtotime("-1 hour"));

php获取前一天的时间:

$mtime= date("Y-m-d H:i:s", strtotime("-1 day"));

php获取三天前的时间:

$mtime= date("Y-m-d H:i:s", strtotime("-3 day"));

php获取前一个月的时间:

$mtime= date("Y-m-d H:i:s", strtotime("-1 month"));

php获取三个月前的时间:

$mtime= date("Y-m-d H:i:s", strtotime("-3 month"));

php获取前一年的时间:

$mtime= date("Y-m-d H:i:s", strtotime("-1 year"));
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!