note 60958 added to function.mktime

From: Date: Sat, 21 Jan 2006 08:24:30 +0000
Subject: note 60958 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-102196@lists.php.net to get a copy of this message
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! ---- Server IP: 203.194.196.146 Probable Submitter: 203.80.97.233 ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60958 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60958&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60958&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60958&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60958&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60958&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60958&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60958&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60958&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102196) next »