简体   繁体   English

在PHP的strtotime中使用第二天

[英]Using next day in strtotime with PHP

It's monday and I run the following: 今天是星期一,我运行以下命令:

$d = date('d-m-Y', strtotime('this tuesday'));

Which gives me date the of tomorrow, 08-07-2014 这给了我明天的日期,2014年8月7日

If i run 如果我跑步

$d = date('d-m-Y', strtotime('next tuesday'));

It provides me the same. 它为我提供了相同的条件。

But how can i easiest get the next tuesday in the next week (not tomorrow)? 但是,我如何最轻松地获得下周(而不是明天)的下一个星期二?

只需尝试:

strtotime('this tuesday +1 week')

您可以执行以下操作

$d = date('d-m-Y', strtotime('next week tuesday'));

您也可以添加天数来获得期望的结果,例如:

date('Y-m-d', strtotime('this tuesday +7 days'));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM