怎么获取2014-11-12三天前的日期

WBOY
Release: 2016-06-23 13:41:49
Original
710 people have browsed it

$time='2014-11-12';

怎么echo到2014-11-09


回复讨论(解决方案)

<?php$time='2014-11-12';echo date('Y-m-d',strtotime("$time-3 days"));?>
Copy after login

$conn=mysqli_connect('localhost','root','root');$res=mysqli_query($conn,"SELECT ADDDATE('2014-11-12',INTERVAL -3 DAY)");$row=mysqli_fetch_array($res);echo $row[0];
Copy after login

2014-11-09
Copy after login

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!