lundi 30 octobre 2017

Javascript Simple If/Else statement for time

I have a task where the user can input the time (hour, minute, second) then he can give a second time (hour, minute, second) but this second time has to be in the same day as the first one and it have to be a later one. Example the user inputs 12:59:59, then 13:00:00. If its correct then it have to substract them.

I have been trying if the second hour is bigger then substract the hour, but the problem is with the minutes / seconds. I can't substract 0 from 59 or so..

Aucun commentaire:

Enregistrer un commentaire