Displaying Time Intervals

From: Date: Thu, 07 Apr 2005 21:48:38 +0000
Subject: Displaying Time Intervals
Groups: php.general 
Request: Send a blank email to php-general+get-212593@lists.php.net to get a copy of this message
Hi, folks. I've added some code to our CMS that tracks the exact amount of time that a user is logged into the system. I'm going to use these stats to track how much time someone has spent practicing in the training environment before I give them access to our production system. Can anyone give me some advice on the best way to display intervals of time? Basically there are two timestamps - time_in and time_out, and I want to for each record display the difference between the two in the format of H:i:s. I'm pulling the timestamp fields from the database in the format of number of seconds since the epoch. Then, cumulatively for each day, I want to display the total time, also in the format of H:i:s. Can anyone give me some advice on how to do this? I thought of date() and strftime(), but I don't see how those would accommodate for someone who spends 30 seconds on the CMS in a single session, since that would need to be displayed as 00:00:30. Is there an existing class that provides such functionality, or should I just write one myself? Cheers and TIA, Pablo

« previous php.general (#212593) next »