Here you can find the source of stringToTimeDate(String timeStr)
public static Date stringToTimeDate(String timeStr)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String FORMATO_HORA = "HH:mm"; private static final String EPOCH = "01/01/1970"; public static Date stringToTimeDate(String timeStr) { return formatStrToDate(FORMATO_HORA, timeStr); }/* w w w . j a v a2 s .c om*/ private static Date formatStrToDate(String format, String dateStr) { if (dateStr.trim().equals("")) { dateStr = EPOCH; } try { SimpleDateFormat curFormater = new SimpleDateFormat(format); return curFormater.parse(dateStr); } catch (ParseException ex) { ex.printStackTrace(); return null; } } }