Get the interval between two times
XuPing.Yang
XuPing.Yang 2021-04-10 16:06:45
0
0
1042

//Calculate the length of two time periods public function GetTimeLong($time1,$time2,$format="i"){ $length = abs($time2 - $time1); if($format=="d" ){ $long = $this->GetFormatOne($length/86400)."day"; }elseif ($format=="h"){ $long = $this->GetFormatOne($length/3600). "Hours"; }elseif ($format=="i"){ } $long = $this->GetFormatOne($length/60)."Minutes"; }else{       $long = $length."Seconds"; } return $long;}//Retain one decimal place function GetFormatOne($num){ $result = $format_num = sprintf("%.1f",$num); return $result;}

XuPing.Yang
XuPing.Yang

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!