[英]Get next day delivery time, but without sunday PHP / Wordpress Function
我正在使用函數來顯示估計交貨時間,如下所示:
// [tomorrow]
function displaydate_tomorrow(){
return date_i18n('l, j. F', strtotime('+1 day'));
}
add_shortcode('tomorrow', 'displaydate_tomorrow');
// end tomorrows date
並且效果很好,但是問題是我需要從字符串中排除“ Sunday”。 有可能做到這一點。
謝謝
您可以先檢查明天是否是星期日。 如果是星期日,請在接下來的兩天而不是第二天。
function displaydate_tomorrow(){
$i = date('l', strtotime('+1 day')) == 'Sunday' ? 2 : 1;
return date_i18n('l, j. F', strtotime("+$i day"));
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.