[英]How to get 2 dates excluding weekend using PHP
我嘗試添加此代碼,但不排除周末。
add_action("woocommerce_after_add_to_cart_button", "custom_shipping_estimate");
function custom_shipping_estimate(){
$date1 = date("F j",strtotime("+ 2 days"));
$date2 = date("F j",strtotime("+ 4 days"));
echo "Arrives between $date1 and $date2";
}
您可以使用 strtotime weekday
日期時間格式
add_action("woocommerce_after_add_to_cart_button", "custom_shipping_estimate");
function custom_shipping_estimate(){
$date1 = date("F j",strtotime("+ 2 weekday"));
$date2 = date("F j",strtotime("+ 4 weekday"));
echo "Arrives between $date1 and $date2";
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.