note 50037 added to function.time

From: Date: Wed, 16 Feb 2005 09:18:40 +0000
Subject: note 50037 added to function.time
Groups: php.notes 
Request: Send a blank email to php-notes+get-85098@lists.php.net to get a copy of this message
Just a simple way to calculate the time passed since a certain date: <?php $delta = time() - mktime(0, 0, 0, 2, 7, 2005); /* Returns seconds since the date used with mktime() */ echo round($delta/(60*60*24),2); /* (60*60*24) Returns days passed since the above date. If you want your script to return minutes, just devide by 60, etc. */ ?> I know this is a trivial problem, but this script can be handy for uptime statistics on your page or something similar. ---- Manual Page -- http://www.php.net/manual/en/function.time.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50037 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50037&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50037&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50037&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50037&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50037&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50037&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#85098) next »