Java Time Parse isTime(String timeStr)

Here you can find the source of isTime(String timeStr)

Description

is Time

License

Apache License

Declaration

public static boolean isTime(String timeStr) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

import java.util.Date;

public class Main {

    public static boolean isTime(String timeStr) {
        SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss");
        Date date = null;/*from  w w  w.  j  av  a2  s.co m*/
        try {
            date = df.parse(timeStr);
        } catch (ParseException e) {
            return false;
        }
        return date != null;
    }
}

Related

  1. isDateTime(String dateTime)
  2. isDateTime(String dateTime, String pattern)
  3. isDatetimeParsable(String value)
  4. isFromartDate(String time)
  5. isTime(final String date)
  6. strtotime(String strtime)