Query about implementation process

In want to create a attendance management app , in this app I want to create a timer,when I click on container of the timer it starts to counting ,then the starting time is save as clock-in time in the database and when I click again on container of the timer it stops counting, then the stopped time is save as clock-out time in the database and the total time between the clock-in and clock-out is save as duration in the database, so anyone can help with regarding to the query

Are you asking how to calculate the difference in time?

If so, just deduct the start time from the end time.