1 //php获取前一个小时的时间:
2
3 $mtime= date("Y-m-d H:i:s", strtotime("-1 hour"));
4 //php获取前一天的时间:
5
6 $mtime= date("Y-m-d H:i:s", strtotime("-1 day"));
7 //php获取三天前的时间:
8
9 $mtime= date("Y-m-d H:i:s", strtotime("-3 day"));
10 //php获取前一个月的时间:
11
12 $mtime= date("Y-m-d H:i:s", strtotime("-1 month"));
13 //php获取三个月前的时间:
14
15 $mtime= date("Y-m-d H:i:s", strtotime("-3 month"));
16 //php获取前一年的时间:
17
18 $mtime= date("Y-m-d H:i:s", strtotime("-1 year"));
来源:https://www.cnblogs.com/realredboy/p/10748171.html