is Date by Regex, one format - Java java.util.regex

Java examples for java.util.regex:Match Date Time

Description

is Date by Regex, one format

Demo Code


import java.util.regex.Pattern;

public class Main{
    /*  w ww  . j av a  2  s. c  o m*/
    public static boolean isDate(String input) {
        if (StringUtil.isEmpty(input)) {
            return false;
        }
        return input.matches("\\d{1,4}-\\d{1,2}-\\d{1,2}");
    }
}

Related Tutorials