On Fri, 22 Jun 2001 06:41, george wrote:
> My back is aganist the wall with this one, I have to create a timer .
>
> What happens is admin will enter a time say 2 hours in the future
> this time will be stored in a db as a time stamp
> then the current time and the timestamp from the db are subtracted from
> one another and the result is shown as hours minutes and seconds.
> but I cant get it to work at all
> any suggestions would be great
>
>
> TIA
> George
This might be the direction you want?
<?php
$now = time(); //Get current timestamp
$then = mktime(0,0,0,7,12,2001);
$diff = $then - $now;
$ary = getdate($diff);
while(list($key, $val) = each($ary)){
echo "$key ==> $val<BR>";
}
?>
Outputs
seconds ==> 46
minutes ==> 16
hours ==> 19
mday ==> 20
wday ==> 2
mon ==> 1
year ==> 1970
yday ==> 19
weekday ==> Tuesday
month ==> January
0 ==> 1676806
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
"I prefer unlined gloves," Tom deferred.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]