timestamp

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
user87
Forum Newbie
Posts: 1
Joined: Sat May 22, 2010 7:34 pm

timestamp

Post 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..
User avatar
hypedupdawg
Forum Commoner
Posts: 74
Joined: Sat Apr 10, 2010 5:21 am

Re: timestamp

Post 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.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: timestamp

Post 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. :)
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
hypedupdawg
Forum Commoner
Posts: 74
Joined: Sat Apr 10, 2010 5:21 am

Re: timestamp

Post 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.
Post Reply