Arrival time: 2345 the previous day
time cleared : 0045
other time: 30 minutes
The total elapsed time is:
60 minutes or the current date's 0045 time - the previous day's 2345.
and 30 minutes or 90 minutes.
You computation is:
(45 - 2345) + 30 = -2270
When you want to compute in minutes:
((24 * 60) + 45) - ((23 * 60) + 45) + 30
1485 - 1425 + 30
With variables for the days and time:
var ArrivalDay = 0;
var ArrivalHour = 23;
var ArrivalMinute = 45;
var DepartureDay = 1;
var DepartureHour = 00;
var DepartureMinute = 45;
var Other = 30;
((DepartureDay * 24 * 60) + (DepartureHour * 60) + DepartureMinute) - ((ArrivalDay * 24 * 60) + (ArrivalHour * 60) + ArrivalMinute) + Other;
How did you come up with these numbers: 1485 - 1425 + 30, now I under stand they come from ((24 * 60) + 45) - ((23 * 60) + 45) + 30??
But where do they come from if the math is: (45 - 2345) + 30 = -2270
Departure is the next day from the arrival date not the same day.