how to convert string to time in java

how to convert string to time in java
ref‮ot re‬:lautturi.com
/**
 * @author lautturi.com
 * Java example: how to convert string to time in java
 */

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

public class Lautturi {

	public static void main(String[] args) {

		String myTime = "21:35:54";
		SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
		Date date = null;
		try {
			date = sdf.parse(myTime);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		String formattedTime = sdf.format(date);

		System.out.println(formattedTime);

	}
}

output:

09:35:54
Created Time:2017-09-03 21:34:48  Author:lautturi