note 11885 deleted from function.mktime by hholzgra

From: Date: Sun, 14 Apr 2002 22:12:50 +0000
Subject: note 11885 deleted from function.mktime by hholzgra
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-29331@lists.php.net to get a copy of this message
Here is a simple algorithm to "count down" exact time to a specific timestamp. $target is a php timestamp sometime in the future. $diff is the difference between then and now. ... so we begin $diff = $target - time(); $days = ($diff - ($diff % 86400)) / 86400; $diff = $diff - ($days * 86400); $hours = ($diff - ($diff % 3600)) / 3600; $diff = $diff - ($hours * 3600); $minutes = ($diff - ($diff % 60)) / 60; $diff = $diff - ($minutes * 60); $seconds = ($diff - ($diff % 1)) / 1; // the /1 thing is a little much but what the hell :P

« previous php.notes (#29331) next »