Here you can find the source of stringToTime(String sTime)
public static Time stringToTime(String sTime) throws Exception
//package com.java2s; //License from project: Open Source License import java.sql.Time; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static Time stringToTime(String sTime) throws Exception { SimpleDateFormat stringToTime = new SimpleDateFormat("HH:mm:ss"); Calendar cal = GregorianCalendar.getInstance(); cal.setTimeInMillis(stringToTime.parse(sTime).getTime()); return new Time(cal.getTimeInMillis()); }//from w ww.j a v a 2 s. c om }