一个关于时间有关问题

WBOY
Release: 2016-06-13 13:44:57
Original
744 people have browsed it

一个关于时间问题
当前的日期通过控件获得:

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->$thisday = $_GET['calendar'];
Copy after login

现在我想求这个日期的前一天(查询日历日期的前一天),怎么求?

注:日历的字符串形式 Y-m-d

------解决方案--------------------
-1day
------解决方案--------------------
echo date('Y-m-d', strtotime("-1 day $thisday"));
------解决方案--------------------
如果$_GET['calendar']的时间格式类似“2012-02-14 11:56:30”,则先转换为time格式:strtotime($_GET['calendar'])
然后减去一天的秒数就可以啦:strtotime($_GET['calendar'])-60*60*24

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!