note 60958 deleted from function.mktime by felipe

From: Date: Sun, 06 Jan 2008 12:04:50 +0000
Subject: note 60958 deleted from function.mktime by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134851@lists.php.net to get a copy of this message
Note Submitter: manhon824 at gmail dot com ---- I read the above note and think up a simple way(just 10 lines) to find time difference in days, hrs, mins, secs! In my way, we do not need to fix the format of time! $starttime=time(); // the start time can change to =strtotime($endtime); $endtime=strtotime($endtime); //$endtime can be any format as well as it can be converted to secs $timediff = $endtime-$starttime; $days=intval($timediff/86400); $remain=$timediff%86400; $hours=intval($remain/3600); $remain=$remain%3600; $mins=intval($remain/60); $secs=$remain%60; //this code is copied from the other note!thx to that guy! $timediff=$days.'days'.$hours.'hr'.$mins.'min'.$secs.'s'; Hope that it is usefull!

« previous php.notes (#134851) next »