Java SQL Time Parse stringToTime(String sTime)

Here you can find the source of stringToTime(String sTime)

Description

string To Time

License

Open Source License

Declaration

public static Time stringToTime(String sTime) throws Exception 

Method Source Code


//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
}

Related

  1. printTime(Time time, String format)
  2. string2Time(String dateString)
  3. string2Time(String time, DateFormat timeFormat)
  4. stringToTime(String data, String dateFormat)
  5. stringToTime(String schedule)
  6. StringToTime(String strDate)
  7. stringToTime(String timeString)