Java examples for java.util.regex:Match Date Time
is Time String by Regex
//package com.java2s; import java.util.regex.Pattern; public class Main { private static Pattern PATTERN_TIME = Pattern .compile("((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])(\\:([0-5]?[0-9]))"); public static boolean isTime(String time) { if (time == null) return false; else/*from ww w . j a va2 s.c o m*/ return PATTERN_TIME.matcher(time).matches(); } }