我找到返回给定日期的周数的函数。但是,相反,我想要返回特定日历周的第一天的日期。这要么是date()本身,要么是date()-1和date()-7之间的任何内容。
目的:我的网站将归还本周的事件。现在,我只显示范围date()+7,这是不正确的。
谢谢和问候,马库斯
发布于 2014-05-10 05:57:56
使用这样的strtotime()函数:
strtotime("next monday");
strtotime("this sunday");
strtotime("last sunday"); 就你而言:
strtotime("this monday");因此,您有时间戳。
第二种方法是这样的:
$day = date('w');
$week_start = date('m-d-Y', strtotime('-'.$day.' days'));
$week_end = date('m-d-Y', strtotime('+'.(6-$day).' days'));https://stackoverflow.com/questions/23577612
复制相似问题