how to calculate time difference using java?
getTime() - d1. getTime(); long diffSeconds = diff / 1000; long diffMinutes = diff / (60 * 1000); long diffHours = diff / (60 * 60 * 1000); System. out. println("Time in seconds: " + diffSeconds + " seconds."); System.