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时间来了解下周三,下周三是时候,我该如何实现呢:)PHP获取特定日期
感谢您的帮助
答
试试这个:
$currentDate = time();
$nextWednesday = strtotime('next wednesday', $currentDate);
echo date('d-m-Y', $nextWednesday);
strtotime需要第二个参数是开始时间。 请参阅https://php.net/manual/ro/function.strtotime.php
+0
为什么这会有所作为?如果你省略了第二个参数,默认情况下它已经是'time()'。 – 2014-11-01 10:37:00
+0
这是一个例子,你可以使用任何你想要的时间戳... – motanelu 2014-11-01 10:38:50
那么,你试图实现你的时间和下一个星期三之间的区别? – 2014-11-01 10:18:31