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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:24:101428browse

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);

Statement:
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