Java comparing two time in strings

Java comparing two time in strings
refer ‮‬to:lautturi.com
/**
 * @author lautturi.com
 * Java example: how to compare two times in java
 */

import java.util.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Lautturi {
	public static void main(String[] args) throws ParseException {
		
		String startTime = "9:19";
	    String endTime = "9:20";
	    SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
	    Date d1 = sdf.parse(startTime);
	    Date d2 = sdf.parse(endTime);
	    long elapsed = d2.getTime() - d1.getTime(); 
	    System.out.println(elapsed);
        
	}
}

output:

60second = 60000 millisecond

60000
Created Time:2017-09-03 09:40:42  Author:lautturi