Time :d

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Time :d

    who cand edit this function
    Code:
    function gettimemsg($sec)
    {
    $days=0;
    $mins=0;
    $hours=0;
    
    if ($sec>59)
    {
    $secs=$sec%60;
    $mins=$sec/60;
    $mins=(integer)$mins;
    }
    
    if ($mins>60)
    {
    $hours=$mins/60;
    $hours=(integer)$hours;
    $mins=$mins%60;
    }
    
    if ($hours>24)
    {
    $days=$hours/24;
    $days=(integer)$days;
    $hours=$hours%24;
    
    }
    if($days>0)
    {
    return "$days days, $hours hours, $mins mins, $secs secs";
    }
    if($days<1)
    {
    
    if($hours>0)
    {
    return "$hours hours, $mins mins, $secs secs";
    }
    if($hours<1)
    {
    return "$mins mins, $secs secs";
    }
    }
    }
    to work to show only second fi the time is unde 1 min ...and the week , and month ....tried 2 do that but fall
    Hate romains that take codes from here and tell to all that they had made that

    #2
    it wil be like this
    Code:
    function gettime($timeinseconds)
    {
    if($timeinseconds < 60 && $timeinseconds >= 0) $var = "sec.";
    elseif($timeinseconds < 3600 && $timeinseconds > 60)
    {
    $new = $timeinseconds;
    $timeinseconds = $new/60;
    $var = "min.";
    }
    elseif($timeinseconds < 86400 && $timeinseconds > 3600)
    {
    $new = $timeinseconds;
    $timeinseconds = $new/3600;
    $var = "hours";
    }
    elseif($timeinseconds > 86400)
    {
    $new = $timeinseconds;
    $timeinseconds = $new/86400;
    $var = "days";
    }
    $timeinseconds = round($timeinseconds, 2);
    if($timeinseconds) return &#39;Idle Time: &#39;.$timeinseconds.&#39; &#39;.$var.&#39;
    \n&#39;;
    }

    Comment


      #3
      mmm not that i told ...pfff to show the only seconds if is under 1 minute // and weeks and months
      Hate romains that take codes from here and tell to all that they had made that

      Comment


        #4
        //////////////////////////gettimemsg

        function gettimemsg($secs)
        {
        $mins=floor(($secs)/60);
        $hours=floor(($mins)/60);
        $days=floor(($hours)/24);
        $weeks=floor(($days)/7);
        if($secs>59)$secs=$secs-($mins*60);
        if($mins>59)$mins=$mins-($hours*60);
        if($hours>23)$hours=$hours-($days*24);
        if($days>6)$days=$days-($weeks*7);
        $msg="";
        if($weeks>0)$msg.=$weeks." week";
        if($weeks>1)$msg.="s";
        if($weeks>0&&$days>0)$msg.=", ";
        if($days>0)$msg.=$days." day";
        if($days>1)$msg.="s";
        if(($days>0||$weeks>0)&&$hours>0)$msg.=", ";
        if($hours>0)$msg.=$hours." hour";
        if($hours>1)$msg.="s";
        if(($hours>0||$days>0)&&$mins>0)$msg.=", ";
        if($mins>0)$msg.=$mins." minute";
        if($mins>1)$msg.="s";
        if($mins>0&&$secs>0)$msg.=", ";
        if($secs>0)$msg.=$secs." second";
        if($secs>1)$msg.="s";
        if(!$secs&&!$mins&&!$hours&&!$days)$msg="0 seconds";
        return $msg;
        }

        usage

        $noi = mysql_fetch_array(mysql_query("SELECT lastact FROM ibwf_users WHERE id=&#39;".$who."&#39;"));
        $var1 = date("His",$noi[0]);
        $var2 = time();
        $var21 = date("His",$var2);
        $var3 = $var21 - $var1;
        $var4 = date("s",$var3);
        echo "Idle For: ";
        $remain = time() - $noi[0];
        $idle = gettimemsg($remain);
        echo "$idle
        ";


        $nopl = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE id=&#39;".$who."&#39;"));
        $membrage = time() - $nopl[0];
        $membrage = gettimemsg($membrage);
        echo "Member For: $membrage
        ";


        Comment


          #5
          i resolved :P:P

          :P:P
          Hate romains that take codes from here and tell to all that they had made that

          Comment

          Working...
          X