Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 计算天数减去周末_Php - Fatal编程技术网

Php 计算天数减去周末

Php 计算天数减去周末,php,Php,我有一个表单,允许用户使用2个jquery日期选择器输入事件的长度,然后使用date将其存储在数据库中 然后返回活动持续的天数,但需要排除周末 例如,如果事件持续时间为Mon-Mon,则返回的结果将为6 以下是我当前从2个日期范围返回天数的方式: <?=(($currentCourseDates)?ceil((strtotime($currentCourseDates[0]['enddate']." 00:00:00") - strtotime($currentCourseDates[0]

我有一个表单,允许用户使用2个jquery日期选择器输入事件的长度,然后使用date将其存储在数据库中

然后返回活动持续的天数,但需要排除周末

例如,如果事件持续时间为Mon-Mon,则返回的结果将为6

以下是我当前从2个日期范围返回天数的方式:

<?=(($currentCourseDates)?ceil((strtotime($currentCourseDates[0]['enddate']." 00:00:00") - strtotime($currentCourseDates[0]['startdate']." 00:00:00")) / 86400)+1:0)?>

这里有很多解决方案:对于php,使用数组、递归、编号