Question: how to find difference between two dates and time in java?
Answer: out. println(endDate); //get the time difference in milliseconds long duration = endDate. getTime() - startDate. getTime(); //now we calculate the differences in different time units //this long value will be the total time difference in each unit //i.e; total difference in seconds, total difference in minutes etc...