我使用以下代碼來顯示基於當天的日期,即如果今天是星期一或星期二,它應該顯示下一個星期三日期,如果有其他日期,它應該顯示下一個星期一日期。在php中顯示基於當前日期的日期
下面是代碼:
<?php
$date = str_replace("/", "-", $date);
$nextWed = date("l jS F, Y",strtotime('next wednesday'));
$nextMon = date("l jS F, Y",strtotime('next monday'));
if(date('D', $timestamp) === 'Mon' or date('D', $timestamp) === 'Tue'){
echo '<div class="time-note">Order your box before Tuesday 11.59pm and get it delivered on '.$nextWed .'</div>';}
else {
echo '<div class="time-note">Order your box before Sunday 11.59pm and get it delivered on '.$nextMon.'</div>';}?>
如果我查看了今天就把它仍然呼應Order your box before Sunday 11.59pm and get it delivered on Monday 19th October 2015
。而應該說Order your box before Tuesday 11.59pm and get it delivered on Monday 14th October 2015
請解釋原因。 –