我遇到的问题是试图查找下周的星期三。
$next_wednesday = strtotime("next Wednesday 19:00:00");
$this_wednesday = strtotime("Wednesday 19:00:00");
$next_wednesday
和$this_wednesday
出来的值相同
我遇到的问题是试图查找下周的星期三。
$next_wednesday = strtotime("next Wednesday 19:00:00");
$this_wednesday = strtotime("Wednesday 19:00:00");
$next_wednesday
和$this_wednesday
出来的值相同
在使用 strtotime 时尝试使用更具体的文本。
$this_wednesday = strtotime('Wednesday this week 19:00:00');
$next_wednesday = strtotime('Wednesday next week 19:00:00');
利用
$this_wednesday = strtotime("Wednesday 19:00:00");
$next_wednesday = strtotime("+1 week Wednesday 19:00:00");
<?php
$this_wednesday = strtotime("Wednesday 19:00:00");
$next_wednesday = strtotime('last Wednesday');
echo date('m/d/y h:i a',$this_wednesday) . "\n" . date('m/d/y h:i a',$next_wednesday);
查看演示
<?php
$year = 2013;
$month = 7;
$day = 5;
echo date("F j, Y, g:i a",strtotime('next Wednesday')).'<br>';
echo date("F j, Y, g:i a",strtotime('next
Wednesday',mktime(0,0,0,$month,$day,$year)));
?>