我有这段代码:
<?php
include_once '../php/connect.php';
if(mysql_num_rows($query) == 0){
echo '<tr><td colspan="6">No data!</td></tr>';
}
else
{
$no = 1;
$i=0;
while($data = mysql_fetch_assoc($query)){
$datetime1 = new DateTime();
$datetime2 = new DateTime($data['lup']);
$interval = $datetime1->diff($datetime2);
$elapsed = $interval->format('%a days %h hours %i minutes %s seconds');
$arraysum[$i] = $elapsed;
echo '<tr>';
echo '<td>'.$data['lup'].'</td>';
echo '<td>'.$elapsed.'</td>';
echo '</tr>';
$no++;
$i++;
}
echo array_sum($arraysum);
?>
如何排除周末(周六和周日),那天不计入差异/间隔?