From 92eee8245d6f230faeb9e1ccc1b792ce2b28d53e Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Wed, 7 Feb 2024 13:32:33 +0700 Subject: [PATCH] timeElapsed --- system/autoload/Lang.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/system/autoload/Lang.php b/system/autoload/Lang.php index eafcc870..8e37ddda 100644 --- a/system/autoload/Lang.php +++ b/system/autoload/Lang.php @@ -56,6 +56,24 @@ class Lang return date($config['date_format'] . ' H:i', strtotime("$date $time")); } + public static function timeElapsed($time){ + $s = $time%60; + $m = floor(($time%3600)/60); + $h = floor(($time%86400)/3600); + $d = floor(($time%2592000)/86400); + $M = floor($time/2592000); + $result = ''; + if($M>0){ + $result = $M.'m '; + } + if($d>0){ + $result .= $d.'d '; + }else if($M>0){ + $result .= '0d '; + } + return "$result$h:$m:$s"; + } + public static function nl2br($text) { return nl2br($text);