Here you can find the source of isTime(final String date)
Parameter | Description |
---|---|
date | the date |
public static boolean isTime(final String date)
//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; } }