Home  >  Article  >  Backend Development  >  php 日期变下个月五号问题

php 日期变下个月五号问题

WBOY
WBOYOriginal
2016-06-20 12:54:00936browse

$date = '2015-06-14';//怎么写会变成2015-07-05


回复讨论(解决方案)

$date = '2015-06-14';echo date('Y-m',strtotime('+1 month',strtotime($date ))).'-05' ;

观察到 2015-06-14 和 2015-07-05 都是 周日
所以有

$date = '2015-06-14';echo date('Y-m-d', strtotime("3 week $date"));
2015-07-05

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