Java Time Parse isTime(final String date)

Here you can find the source of isTime(final String date)

Description

Checks if is time.

License

Open Source License

Parameter

Parameter Description
date the date

Return

true, if is time

Declaration

public static boolean isTime(final String date) 

Method Source Code


//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {
    /** The Constant TIME. */
    private static final SimpleDateFormat TIME = new SimpleDateFormat("HH:mm");

    /**/* ww w  . ja v  a2  s .  com*/
     * Checks if is time.
     * 
     * @param date
     *            the date
     * @return true, if is time
     */
    public static boolean isTime(final String date) {
        boolean result;
        try {
            TIME.parse(date);
            result = true;
        } catch (ParseException e) {
            result = false;
        }
        return result;
    }
}

Related

  1. getTimeX(String dateStr)
  2. isDateTime(String dateTime)
  3. isDateTime(String dateTime, String pattern)
  4. isDatetimeParsable(String value)
  5. isFromartDate(String time)
  6. isTime(String timeStr)
  7. strtotime(String strtime)