Home > Backend Development > PHP Tutorial > php获取前一天,前一个月,前一年的时间

php获取前一天,前一个月,前一年的时间

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 13:33:14
Original
2303 people have browsed it

获取前一天的时间:

$mytime= date("Y-m-d H:i:s", strtotime("-1 day"));
Copy after login

获取三天前的时间:

$mytime= date("Y-m-d H:i:s", strtotime("-3 day"));
Copy after login

获取前一个月的时间:

$mytime= date("Y-m-d H:i:s", strtotime("-1 month"));
Copy after login

获取前3个月的时间:

$mytime= date("Y-m-d H:i:s", strtotime("-3 month"));
Copy after login

获取前一个小时的时间:

$mytime= date("Y-m-d H:i:s", strtotime("-1 hour"));
Copy after login

获取前一年的时间:

$mytime= date("Y-m-d H:i:s", strtotime("-1 year"));
Copy after login



Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template