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!
New php coder here. I am working on a project that has a timer in it. The timer displays the elapsed time to the user. My code is not complete yet but I have been getting unintended results and I cannot figure out why. I am hoping someone would shed some light on it. The code puts a start timestamp into the database, then to get the time elapsed since the start timestamp it is subtracted from the current timestamp. The "i:s" work as intended, however for some reason the "H:" is returning 19, I have no idea why. I also tried using the php datetime object to generate timestamps but got the same results.
I don't think it's as easy as that. Date/time difference calculation is complicated. You need to extract the number of hours from the difference, then the minutes, and then the seconds remain. Like this:
I appreciate you helping me out with my problem. The code is working as intended now. I will also add if there is anyone else out there with a similar problem I used...