I have a flight itinerary program where I need to get difference between departure and arrival time. I get these specified times as String from the data. Here is my problem:
The total number of minutes in 24 hours is 1440. So when the difference is below zero (but you need a positive one) then you should add a whole day to your result:
int diff = MINUTES.between(arrival, a);
if (diff < 0) {
diff += 1440;
}
You can achieve the same thing using this:
int diff = (MINUTES.between(arrival, a) + 1440) % 1440;