Page 1 of 1

timestamp

Posted: Sat May 22, 2010 7:45 pm
by user87
hey guys, new to php, i have 2 submit buttons and i would like that when the 1st button is clicked i get a timestamp for that action and do the same to the 2nd button and will calculate the difference of those timestamps to get the duration taken to click another button.
AKA getting a timestamp for each button click..

Re: timestamp

Posted: Sun May 23, 2010 1:19 pm
by hypedupdawg
PHP has function called date(). Useful information can be found on this page here. I would use the date('c') for a timestamp.

Re: timestamp

Posted: Mon May 24, 2010 12:37 pm
by AbraCadaver
hypedupdawg wrote:PHP has function called date(). Useful information can be found on this page here. I would use the date('c') for a timestamp.
Or time(). Easier to subtract. :)

Re: timestamp

Posted: Mon May 24, 2010 4:14 pm
by hypedupdawg
Good point - especially when the timestamps are going to be discarded (on a page like this).

Of course, if you're going to need solid records, a date-and-timestamp is worth the effort of exploding it at the other end.