nogray
-
Posts
930 -
Joined
-
Last visited
Posts posted by nogray
-
-
-
If the the text input (not textarea) have the focus, the form should be submitted by hitting the enter key. You can set the focus to the text input when the page load.
-
I notice the solutions where a bit too complicated for this problem
time() function in php will return the number of seconds, so if you have two times and subtract them, you'll get the difference in seconds. All you have to do is convert that into minutes, hours, days, etc...
I wrote a small function that will do that
[code]function convert_time($seconds){
$f_minutes = $seconds / 60;
$i_minutes = floor($f_minutes);
$r_seconds = intval(($f_minutes - $i_minutes) * 60);
$f_hours = $i_minutes / 60;
$i_hours = floor($f_hours);
$r_minutes = intval(($f_hours - $i_hours) * 60);
$f_days = $i_hours / 24;
$i_days = floor($f_days);
$r_hours = intval(($f_days - $i_days) * 24);
if ($i_days > 0) $r = "$i_days days ";
if ($r_hours > 0) $r .= "$r_hours hours ";
if ($r_minutes > 0) $r .= "$r_minutes min";
else $r = "less than a minute";
return $r;
}[/code]
the f_ is for float i_ is for int and r_ is the return value. I only need days, so you can keep going for months and years the same way.
Good luck,
Wesam Saif
[a href=\"http://www.nogray.com\" target=\"_blank\"]http://www.nogray.com[/a]
document.all in Safari
in Javascript Help
Posted