This should work.
long secs = (this.endDate.getTime() - this.startDate.getTime()) / 1000;
int hours = secs / 3600;
secs = secs % 3600;
int mins = secs / 60;
secs = secs % 60;
More Related Contents:
- Java string to date conversion
- Calculating the difference between two Java date instances
- What is this date format? 2011-08-12T20:17:46.384Z
- Convert timestamp in milliseconds to string formatted time in Java
- Should I use Java date and time classes or go with a 3rd party library like Joda Time?
- Java 8 Instant.now() with nanosecond resolution?
- System.currentTimeMillis() vs. new Date() vs. Calendar.getInstance().getTime()
- How can I “pretty print” a Duration in Java?
- How can I ensure in Java that the current local time is correct? [duplicate]
- How to round time to the nearest quarter hour in java?
- Conversion from 12 hours time to 24 hours time in java
- How to check a timeperiod is overlapping another time period in java
- Java code for getting current time [duplicate]
- Convert java.time.Instant to java.sql.Timestamp without Zone offset
- Why does Java’s java.time.format.DateTimeFormatter#format(LocalDateTime) add a year?
- How to properly format the date?
- How to stop execution after a certain time in Java?
- How to convert HH:mm:ss.SSS to milliseconds?
- Parsing time strings like “1h 30min”
- I want to get current time in Java but without the Internet and without the system time
- java.lang.System.currentTimeMillis() replace method
- Getting the current time millis from device and converting it into a new date with different timezone [duplicate]
- How do I get difference between two dates in android?, tried every thing and post
- DateTimeParse Exception
- GPS Time Representation library
- Getting Date in HTTP format in Java
- CPU execution time in Java
- How can I find the amount of seconds passed from the midnight with Java?
- When will System.currentTimeMillis() overflow?
- Run code for x seconds in Java?