+ 1

I need to add features to my stop watch

Hi guys I have created this stop watch however i need to add two things 1 is the stop time whenever i click stop 2 is the current time which reads my system time Can you help? 😎 https://code.sololearn.com/WNIBuWpQ56Up/?ref=app https://code.sololearn.com/WNIBuWpQ56Up/?ref=app

12th Dec 2017, 10:10 PM
AJ-963
14 Respuestas
+ 5
You could create a table, and use insertAdjacentHTML to update the elapsed times into table rows. Check out the code https://code.sololearn.com/Wr0V54pu60L2/?ref=app ps I corrected a reset button bug.
13th Dec 2017, 12:44 AM
Calviղ
Calviղ - avatar
+ 2
by using the system time you can store that in a variable and on each update grab the current system time and simple subtraction will give you the time elapsed and place that value in your label.
12th Dec 2017, 11:31 PM
Michael Simnitt
Michael Simnitt - avatar
12th Dec 2017, 11:32 PM
Michael Simnitt
Michael Simnitt - avatar
+ 2
this code will demonstrate how to get and use the data object for the current date. also if you wanted to add a pause button all you would have to do is have it update the variable storing your start time on resume and it should work perfectly.
12th Dec 2017, 11:37 PM
Michael Simnitt
Michael Simnitt - avatar
+ 2
I'm getting the same values for stopped and elapsed times
13th Dec 2017, 12:15 AM
Michael Simnitt
Michael Simnitt - avatar
+ 2
take a look at the code I posted it will show you how to do minutes and such I have them all broken down separately
13th Dec 2017, 12:17 AM
Michael Simnitt
Michael Simnitt - avatar
+ 2
Really thank you guys, you all have been a great help ❤️🌹🌹🌹🌹🌹
13th Dec 2017, 12:48 AM
AJ-963
+ 1
Also please check line 84 I want only the hours minutes and seconds I do not want the date day and time etc
13th Dec 2017, 12:14 AM
AJ-963
0
I didn't see a problem with the stop button. It worked perfectly every time I tried it. Local system time can be gotten via this method. https://stackoverflow.com/questions/10659523/how-to-get-the-exact-local-time-of-client
12th Dec 2017, 10:35 PM
John Wells
John Wells - avatar
0
Hay Thanks for the comment, maybe i didn't clarify enough What i meant i have timelabel already I need to additional time labels One captures the time I clicked stop Second one capture my system time(i will try ur method)
12th Dec 2017, 10:38 PM
AJ-963
0
Ids could be anything. You could use timLabel, timeLbl, time, label, time1, time2, etc. I'd use timer for your stop time, since it is working as a timer (stopWatch could work too.) I'd use systemTime for your second.
12th Dec 2017, 10:51 PM
John Wells
John Wells - avatar
0
Oh sorry again 😁 Let me explain clearly Once you click start the watch start counting, so this counter is considered as (elapsed time) Once i click stop, it freezes on the time i stopped in What i want, i need the stopped time to be recorded and displayed in a different box. So if i click start again I'll have two boxes Elapsed and stop
12th Dec 2017, 10:57 PM
AJ-963
0
so add an elapsed label. Personally, I'd add a second h1 to store it.
12th Dec 2017, 11:09 PM
John Wells
John Wells - avatar
0
Many thanks guys I just did something, can you check the following code and run it https://code.sololearn.com/WXB548k7464x/?ref=app
13th Dec 2017, 12:13 AM
AJ-963