Im编码一个系统,如一个产品撤回系统,例如:某些产品类别有X天被撤回。
类别- Buziness日
1-1-1
2/2-3
3/4
4/3
5/3
6-3
7/4
例如,今天是2009-05-22星期三:如果我的产品是7,+4天,我的退出将在2019年-05-28。
我还有一个“问题”,那个系统是用PHP 4构建的!
谢谢!
发布于 2019-05-21 00:08:11
使用了简单日期和strtotime,它来自PHP4
<?php
$CurrentDate = date('Y-m-d');
$businessdays = 4;
$checkloop = 0;
While($checkloop<$businessdays){
$CurrentDate = date('Y-m-d', strtotime( "$CurrentDate + 1 day" ));
$day = date('l', strtotime($CurrentDate));
if($day!='Saturday' && $day!='Sunday')
++$checkloop;
}
print_r($CurrentDate);
print_r($day);
?>输出
目前日期为2019年-05-21
2019-05-27星期一
https://stackoverflow.com/questions/56229277
复制相似问题