我用这个绕了很长时间,我试图做的是获得本周的开始和结束日期。本周从5月20日(星期一)到5月26日(星期日)我的做法://GETTING DATA FOR CURRENT WEEK$dtFrom_current = new DateTime; // get current date$dtTo_current = new DateTime;$dtFrom_current->setISODate($dtFrom_current->format('o'), $dtFrom_current->format('W'));$dtTo_current->setISODate($dtTo_current->format('o'), $dtTo_current->format('W') );// add 1 day$dtTo_current->add(new DateInterval('P1D') + 1 );// convert to iso date for database useecho $dFrom_current = $dtFrom_current->format('Y-m-d');echo $dTo_current = $dtTo_current->format('Y-m-d'); 但我很确定我做错了什么,但不知道是什么,任何帮助表示赞赏。
1 回答
- 1 回答
- 0 关注
- 175 浏览
添加回答
举报
0/150
提交
取消