Retrieving total playtime since registration! [MySQL]
#10

You don't even need all those variables and timers. The only thing you need is one (1) field in your table. Save the registration timestamp in there by means of the UNIX_TIMESTAMP() functionality. This is a value that measures the seconds elapsed since the epoch on 1/1/1970.

Whenever you want to retrieve the time played, subtract the saved timestamp from the current timestamp. This will give you a value in seconds. Use an algorithm to convert it to minutes and hours.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)