Java SQL Time Parse parseTime(String s)

Here you can find the source of parseTime(String s)

Description

parse Time

License

Open Source License

Declaration

public static Time parseTime(String s) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.sql.Time;

import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {
    private static SimpleDateFormat simpleTimeFormat = new SimpleDateFormat("HH:mm:ss");

    public static Time parseTime(String s) {
        if (s == null) {
            return null;
        }//w  w  w .  j  av  a  2  s . c om

        try {
            return new Time(simpleTimeFormat.parse(s).getTime());
        } catch (ParseException e) {
            return null;
        }
    }
}

Related

  1. parseDateTime(String original, int type)
  2. parseTime(String str)
  3. parseTime(String timeString)
  4. printTime(Time time, String format)
  5. string2Time(String dateString)