MCPcopy Create free account
hub / github.com/Bit0r/java-util / isDate

Method isDate

src/main/java/util/ExcelUtils.java:269–280  ·  view source on GitHub ↗

时间是否合格 @param strDate 时间 @param dateFormat "yyyy-MM-dd" @param legalLen 10 , 19 @return

(String strDate, String dateFormat, int legalLen)

Source from the content-addressed store, hash-verified

267 * @return
268 */
269 private static boolean isDate(String strDate, String dateFormat, int legalLen) {
270 if ((strDate == null) || (strDate.length() != legalLen)) {
271 return false;
272 }
273 try {
274 SimpleDateFormat formatter = new SimpleDateFormat(dateFormat);
275 Date date = formatter.parse(strDate);
276 return strDate.equals(formatter.format(date));
277 } catch (Exception e) {
278 return false;
279 }
280 }
281
282
283

Callers 1

dateFormatMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected