PHP将在特定日期的下周三获得

时间:2014-11-01 10:13:05

标签: php

$wed_date = strtotime('next wednesday');

$my_time = $some_unix_time; 

//how do I get this line below to work
$the_next_wednesday_from_my_time = "";

例如我想从unix时间知道,下周三是什么时候,我该如何实现它:)

感谢您的帮助

1 个答案:

答案 0 :(得分:3)

试试这个:

$currentDate   = time();
$nextWednesday = strtotime('next wednesday', $currentDate);

echo date('d-m-Y', $nextWednesday);

strtotime采用第二个参数,即起始时间。 见https://php.net/manual/ro/function.strtotime.php