[thelist] Adding 15 mins to PHP time...
Tris
beertastic at gmail.com
Wed Dec 13 10:20:41 CST 2006
Just this sec realised that.. cut cheers!
My code is not working...
I've changeds the 15misn to 10 seconds for testing.. but it's not
working, any thoughts?
============================
if ((!isset($_SESSION[timeStart])) && (!isset($_SESSION[timeEnd]))) {
$_SESSION[timeStart] = strtotime('now');
$_SESSION[timeEnd] = strtotime('+10 second');
} else {
$now = strtotime('now');
if ($_SESSION[timeStart] > $_SESSION[timeEnd]) {
$pageDisplay = "<B>TIMES UP!</b>";
} else {
$pageDisplay = "Keep going!";
}
$pageDisplay .= "
<p />Current Time: $now
<hr />
<p />Time to end: $_SESSION[timeEnd]
<p />start Time: $_SESSION[timeStart]
";
}
============================
On 13/12/06, Ken Robinson <kenrbnsn at rbnsn.com> wrote:
> Quoting Tris <beertastic at gmail.com>:
>
> > MAny thaks to all..
> > I ended up doing:
> >
> > $_SESSION[timeStart] = date("H:i:s");
> > $_SESSION[timeEnd] = date('H:i:s',strtotime('+15 minute'));
> >
> > and just putting::
> >
> > if ($_SESSION[timeEnd] <= $_SESSION[timeStart]) {
> > $pageDisplay = "TIMES UP!";
> > }
> >
> > on each page...
> >
> > Hopefully it'll work.. right? ;-p
> > o rdo I have to convert it to a unix time stamp blah blah blah..
>
> Remember, you're comparing strings here. If you convert to a UNIX
> timestamp you
> will be comparing integers.
>
> Ken
>
>
> --
>
> * * Please support the community that supports you. * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>
More information about the thelist
mailing list