Question: how to difference time in java?
Answer: String start = "12:00:00"; String end = "02:05:00"; SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss"); Date date1 = format. parse(start); Date date2 = format. parse(end); long difference = date2. getTime() - date1.