• Downloading from our site will require you to have a paid membership. Upgrade to a Premium Membership from 10$ a month today!

    Dont forget read our Rules! Also anyone caught Sharing this content will be banned. By using this site you are agreeing to our rules so read them. Saying I did not know is simply not an excuse! You have been warned.

Share đoạn function đếm giờ

Admin

Well-Known Member
Staff member
Administrator
Code hiển thị thời gian được đăng cách đây mấy phút, mấy giây
PHP:
<?
function gio($gio){
$time=time();
$tuoitrevn=round(($time-$gio)/60);
//Làm tròn thời gian lấy time hiện tại trừ time bài viết gửi đem chia cho 60 giây
if($tuoitrevn<1){$jun='Vừa xong';}
// Nếu thời gian làm tròn < 1 => vừa xong

if(tuoitrevn>=1 && $tuoitrevn<60){$jun="$tuoitrevn Phút trước";}
if($tuoitrevn>=60 && $tuoitrevn<1440){$tuoitrevn=round($tuoitrevn/60); $tuoitrevn="$tuoitrevn Giờ trước";}
if($tuoitrevn>=1440){$tuoitrevn=round($tuoitrevn/60/24); $tuoitrevn="$tuoitrevn Ngày trước";}
return $tuoitrevn;
}
?>
 

Facebook Comments

Similar threads

New posts New threads New resources

Back
Top