[英]How to get 2 dates excluding weekend using PHP
I tried to add this code, but it doesn't exclude weekends.我尝试添加此代码,但不排除周末。
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";
}
You can use the strtotime weekday
date time formats您可以使用 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.