java calculate date and time difference in seconds code example
Example: date difference in minutes java
long diff = d2.getTime() - d1.getTime();//as given
long seconds = TimeUnit.MILLISECONDS.toSeconds(diff);
long minutes = TimeUnit.MILLISECONDS.toMinutes(diff);