This article mainly introduces two methods for obtaining PHP time to exclude Saturday and Sunday, for more information about how to obtain a timestamp after 10 days, we can share with you today. The key to the program is that it does not count as Saturday. If you have other requirements. It can be changed to N days. It's not Saturday. Haha.
// Method 1: <? Php $ now = time (); // specify the date usage $ now = strtotime ('2017-01-08 '); $ day = 2014*24; $ total = 12; $ days = array (); for ($ I = 2; $ I <$ total; $ I ++) {$ timer = $ now + $ day * $ I; $ num = date ("N", $ timer)-2; // if ($ num >=- 1 and $ num <= 3) starting on Monday) {if (count ($ days)> = 10) break; $ days [] = date ("Y-m-d", $ now + $ day * $ I ); $ total + = 1; // $ total = 12? $ Total + 1: $ total;} else {$ total = 12? $ Total + 1: $ total ;} I I = 1; foreach ($ days as $ day) {echo "$ I ==> ". $ day. "\ n"; $ I ++;} // Method 2: function get_days ($ date = "") {$ now = empty ($ date )? Time (): strtotime ($ date); $ days = array (); $ I = 2; while (count ($ days) <10) {$ timer = $ now + 3600*24 * $ I; $ num = date ("N", $ timer)-2; // if ($ num >=- 1 and $ num <= 3) {$ days [] = date ("Y-m-d ", $ now + 3600*24 * $ I);} $ I ++;} return $ days ;}