Java Data Type How to - Java calculate time difference error


We would like to know how to java calculate time difference error.


import java.text.SimpleDateFormat;
import java.util.Date;
/*from  ww  w  .  java 2 s  .  co m*/
public class Main {
  public static void main(String[] args) throws Throwable {
    SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
    Date date1 = format.parse("08:00:01");
    Date date2 = format.parse("23:00:05");
    Date date = new Date(date2.getTime() - date1.getTime());

The code above generates the following result.