So i have 2 input fields(BeginTime and EndTime) and a user can insert time with a time picker plugin called Datebox using the 24 Hour time Format.
On Change those inputs should calculate the hours between those times.
e.g
BeginTime: 08:00
EndTime:16:00
Result: 8 Hours
Times like
BeginTime:18:00
EndTime:02:00
Result: 8 Hours
Should also be possible same goes with negative Hours
Now i only can manage to get the hours between Positive times and only with begintime > endtime here is my code:
var timehour = end.split('.')[0] - begin.split('.')[0];
var timeminut = end.split('.')[1] - begin.split('.')[1];
if (timeminut< 0){
timehour--;
timeminut= 60 + timeminut;
}...giving out the result
So how do i calculate the other time possibilities?
P.S i am using jquery mobile