/**
* 验证日期边界
* @param strDate
* @return
*/
public static Boolean isDateValid(String strDate)
{
Boolean result = false;
final String pattern = "yyyyMMddHHmmss";
final String strFormat = "%1$tY%1$tm%1$td%1$tH%1$tM%1$tS";
SimpleDateFormat df = new SimpleDateFormat(pattern);
ParsePosition pos = new ParsePosition(0);
try
{
Date tmpDate = df.parse(strDate, pos);
if (tmpDate != null)
{
Calendar CalendarResult = Calendar.getInstance();
CalendarResult.setTime(tmpDate);
String strResultDate = String.format(strFormat, CalendarResult);
result = strDate.equalsIgnoreCase(strResultDate);
}
}
catch (Exception e)
{
}
return result;
}
验证日期边界
最新推荐文章于 2021-07-19 16:36:35 发布