php strtotime"2 Sunday ago"

upt*_*nhr 1 php strtotime

在此错误的日期/时间,它是"2014年3月24日上午7:08".通常,在strtotime()上运行"2 Sunday ago"将导致回到2个星期日.因此,它将导致3/16.然而,它是在3/23登陆,这是最后一个星期天.此外,运行"1 Sunday ago"将导致未来日期为3/30而不是3/23.我假设它有某种设置问题,但不知道如何调试.任何帮助都会很棒.

谢谢!

$start = date( "Y-m-d 11:00:00", strtotime("2 Sunday ago"));
$end = date( "Y-m-d 11:00:00", strtotime("Last Sunday"));
echo $start . ' - ' . $end;
Run Code Online (Sandbox Code Playgroud)

Yat*_*edi 9

试试吧

 $start = date( "Y-m-d 11:00:00", strtotime("-2 weeks sunday"));
 $end = date( "Y-m-d 11:00:00", strtotime("-1 weeks sunday"));
 echo $start . ' - ' . $end;
Run Code Online (Sandbox Code Playgroud)