php 日期操作 天数添1

WBOY
Release: 2016-06-13 13:25:59
Original
1263 people have browsed it

php 日期操作 天数加1

?

?

#给定一个日期:
$s= '2012-05-28 14:23:43';

#在这个日期上加上1天 得到新日期

echo date('Y-m-d H:i:s',strtotime("$s +1 day"));

#输出 2012-05-29 14:23:43
Copy after login
<pre class="php" name="code">4.strstotime()函数转化时间戳

echo(strtotime("now")); //1138614504
echo(strtotime("3 October 2005")); //1128290400
echo(strtotime("+5 hours")); //1138632504
echo(strtotime("+1 week")); //1139219304
echo(strtotime("+1 week 3 days 7 hours 5 seconds")); //1139503709
echo(strtotime("next Monday")); //1139180400
echo(strtotime("last Sunday")); //1138489200
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!