[thelist] Adding 15 mins to PHP time...

Eduardo Kienetz eduardok at gmail.com
Wed Dec 13 09:46:57 CST 2006


On 12/13/06, Tris <beertastic at gmail.com> wrote:
> I'm creating a timer for todays lucky client...
> They wanna hit start and have a timer on screen across all pages..
> No prob doing that in javascript, so I'm gonna create a session called
> timer with the date value:
> date("H:i:s"); Giving: 15:42:34 etc.. (the precise users start time)
>
> What I need to do is on each page, check the current server time, and
> if it's 15 mis higher than my session, redirect the user to a thank
> you page and destroythetimer session..
>
> soooo...
>
> How can I add 15 mins to a date function?
> (I'm also gonna have to fee different times to the javasript ticker,
> but that'll be easiy once I kno whow to knock off time from um, well,
> time :-p  )

$startDate = "01/08/2006 08:04:20";
echo date("d/m/Y H:i:s", strtotime("+15 minutes",strtotime($startDate)));
Will print: 08/01/2006 08:19:20

-- 
Eduardo  Bacchi Kienetz
LPI Certified - Level 2
http://www.noticiaslinux.com.br/eduardo/



More information about the thelist mailing list