使用java判断字符串是否日日期类型

发布于:2021-06-13 22:28:26

public static boolean checkStrFormat(String str) {
Pattern pattern = Pattern.compile("^([0-9]{4})((0([1-9]{1}))|(1[0-2]))(([0-2]([0-9]{1}))|(3[0|1]))(([0-1]([0-9]{1}))|(2[0-4]))([0-5]([0-9]{1}))([0-5]([0-9]{1}))");
Matcher matcher = pattern.matcher(str);
boolean bool = matcher.matches();
return bool;
}

相关推荐

最新更新

猜你喜欢