Home > Backend Development > PHP Tutorial > PHP如何表示某一个时间的前一天12点

PHP如何表示某一个时间的前一天12点

WBOY
Release: 2016-06-13 12:24:10
Original
1413 people have browsed it

PHP怎么表示某一个时间的前一天12点

某个时间的前一天12点,  怎么用PHP算出来

某个时间为变量。
------解决思路----------------------

<?php<br /><br />date_default_timezone_set('PRC');<br /><br />$now = time(); //某个时间,可以是任意时间戳<br />$ago = strtotime('-1 day 12:00:00', $now); //一天前的12:00:00的时间戳,两天前-2 day即可<br /><br />echo date('Y-m-d H:i:s', $ago);
Copy after login

Related labels:
source:php.cn
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