I have two objects Calendar, and I want to check what is the difference between them, in hours.
Here is the first Calendar
Calendar c1 = Calendar.getInstance();
And second Calendar
Calendar c2 = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
c2.setTime(sdf.parse("Sun Feb 22 20:00:00 CET 2015"));
Now let's say that c1.getTime(): Fri Feb 20 20:00:00 CET 2015it c2.getTime()is Sun Feb 22 20:00:00 CET 2015.
So is there any code that returns the difference between the first and second Calendarin the watch? In my case, he should be back 48.
source
share