所以我有这个:
$start_date = date('Y-m-d',strtotime('Friday 17:00'));
$end_date = date('Y-m-d',strtotime("+2 days", strtotime('Friday')));
$conditions['scope'] = " (event_start_date BETWEEN CAST('$start_date' AS DATE) AND CAST('$end_date' AS DATE)) OR (event_end_date BETWEEN CAST('$end_date' AS DATE) AND CAST('$start_date' AS DATE))";
我希望在即将到来的周末(周五1700 - 周日)输出日期,直到我到星期五,然后它开始显示下周末。
我怎样才能让它显示当前的周末直到周日结束,然后显示下周末?
答案 0 :(得分:0)
$end_date = date('Y-m-d', strToTime('this Sunday'));
以下是strToTime's relative dates的参考资料。
答案 1 :(得分:0)
$end_date = date('Y-m-d',strtotime('Sunday'));
$start_date = date('Y-m-d',strtotime($end_date . ' -2 days '));