首頁  >  問答  >  主體

取得兩個時間之間的間隔

//計算兩個時段長度public function GetTimeLong($time1,$time2,$format="i"){    $length = abs($time2 - $time1);    if($format=="d" ){        $long = $this->GetFormatOne($length/86400)."天";    }elseif ($format=="h"){        $long = $this-h-> "小時";    }elseif ($format=="i"){        $long = $this->GetFormatOne($length/60)."分鐘";    }else{  longh   長度$. return $long;}//保留小數點後一位function GetFormatOne($num){    $result = $format_num = sprintf("%.1f",$num);    return $result;}

XuPing.YangXuPing.Yang1263 天前982

全部回覆(0)我來回復

無回覆
  • 取消回覆