I have a list of Dates that looks like this:
I/System.out: TAG: Mon Jun 20 15:36:00 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 15:51:55 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 15:52:14 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 16:24:01 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 18:39:07 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 18:49:02 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 20:24:26 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 20:52:23 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 22:41:50 GMT+02:00 2022
I/System.out: TAG: Mon Jun 20 22:55:54 GMT+02:00 2022
How do I calculate to subtract each i+1 element from the i element(example: TAG: Mon Jun 20 15:51:55 GMT+02:00 2022 - TAG: Mon Jun 20 15:36:00 GMT+02:00 2022) difference is 21 minutes.
I tryed something like this:
for(int i=0;i<list.size()-1;i++){
parked += list.get(i+1).getTime() - list.get(i).getTime();
}
System.out.println("parked time: "+parked / 60 000);
and I get 434 minutes instead of 98... Can someone help? Thanks in regards