Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date stringToHour(String str) { Date date = null; SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); try { date = formatter.parse(str); return date; } catch (Exception e) { return null; } } }