周末日期退货问题

发布于 2024-12-14 22:58:55 字数 459 浏览 3 评论 0原文

所以我有这个:

$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 - 周日),直到我到达周五,然后它开始显示下一个周末。

我怎样才能让它显示当前周末直到周日结束,然后显示下一个周末?

So I have this:

$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))";

I want the dates to output for the coming weekend (Fri at 1700 - Sun), which it does until I get to Friday, then it starts to show the next weekend.

How can I get it to show the current weekend until end of Sunday when it then shows the next weekend?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰雪之触 2024-12-21 22:58:55
$end_date = date('Y-m-d',strtotime('Sunday'));
$start_date = date('Y-m-d',strtotime($end_date . ' -2 days '));
$end_date = date('Y-m-d',strtotime('Sunday'));
$start_date = date('Y-m-d',strtotime($end_date . ' -2 days '));
梦罢 2024-12-21 22:58:55
$end_date = date('Y-m-d', strToTime('this Sunday'));

以下是strToTime 的相对日期的参考。

$end_date = date('Y-m-d', strToTime('this Sunday'));

Here is the reference for strToTime's relative dates.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文