Home >Backend Development >PHP Tutorial >如何获取2014-11-12三天前的日期

如何获取2014-11-12三天前的日期

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:13:421014browse

怎么获取2014-11-12三天前的日期
$time='2014-11-12';

怎么echo到2014-11-09
------解决思路----------------------

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

------解决思路----------------------
<br />$conn=mysqli_connect('localhost','root','root');<br />$res=mysqli_query($conn,"SELECT ADDDATE('2014-11-12',INTERVAL -3 DAY)");<br />$row=mysqli_fetch_array($res);<br />echo $row[0];<br />

<br />2014-11-09<br />

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