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

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

WBOY
WBOYOriginal
2016-06-23 13:41:49769browse

$time='2014-11-12';

怎么echo到2014-11-09


回复讨论(解决方案)

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

$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];

2014-11-09

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