Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.sql.Time;

import java.text.SimpleDateFormat;

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

    /**
     * Parse time string to Time "HH:mm:ss".
     *
     * @param timeStr
     * @return Date
     */
    public static Time parseTime(String timeStr) {
        try {
            return new Time(TIME_FORMATTER.parse(timeStr).getTime());
        } catch (Exception e) {
            return null;
        }
    }
}