【发布时间】:2020-09-02 17:45:59
【问题描述】:
试图弄清楚以下内容:
我的俱乐部每周运营 3 天,周二、周四和周六。
我想打印本周的下一个俱乐部日期,因此如果周二是下一次会议,则打印“周二”,或者如果今天是周二,则打印“今天”,周四和周六也是如此。
我有以下代码:
<?php
$current = date('l', strtotime('now'));
$tuesday = date('l', strtotime('tuesday this week'));
$thursday = date('l', strtotime('thursday this week'));
$saturday = date('l', strtotime('saturday this week'));
if ($tuesday < $current) {
echo "Tuesday in the future";
} else if ($thursday < $current) {
echo "Thursday in the future";
} else if ($saturday < $current) {
echo "Saturday in the future";
}
?>
这就是我做不到的地方,无法弄清楚....因为它总是只打印“未来的星期二”。
非常欢迎任何帮助、建议或解释!
谢谢 E
【问题讨论】:
-
请记住,这种不指定小时的方法将返回
Today,即使在一天的训练中已经是23:59。
标签: php