Stopwatch/Timer

Hello,

I’m trying to create a stopwatch/timer on my page that logs the time difference between when the timer was started and when the timer ended to get the “time duration”.

There is a Zeroqode plugin but that only works while the user is on the page. I understand I’ll likely have to create a stopwatch that types the “start event time” and “stop event time” and then create a way to calculate the difference. Any ideas on how I can do this?

Thank you

Are you wanting to display an actual timer on the page?

Or just log the start and end times?

Hello,

Looking to do both. So basically after you start the timer, you can close out and the timer is still running until you click stop, regardless of if you’re still using the app or not.

Thanks,

To set a start time you just need to record the time in the database somewhere.

Then you can do whatever you like with that (i.e. compare it to the current time, compare it to a defined end-time etc.).

You can save those in the DB or just display them dynamically in the browser.

If you want to show the difference in a real-time timer in the browser you’ll probably want to use a plugin to reference the times (there are a few about) or possibly some simple javascript.

3 Likes