public static boolean checkValidDate(String pDateObj) {
try{
int year = new Integer(pDateObj.substring(0, 4)).intValue();
int month = new Integer(pDateObj.substring(4, 6)).intValue();
int date = new Integer(pDateObj.substring(6, 8)).intValue();
int hourOfDay = new Integer(pDateObj.substring(8, 10)).intValue();
int minute = new Integer(pDateObj.substring(10, 12)).intValue();
int second = new Integer(pDateObj.substring(12, 14)).intValue();
Calendar cal = Calendar.getInstance();
cal.setLenient( false ); //允許嚴格檢查日期格式
cal.set(year, month-1, date);
cal.set(year, month - 1, date, hourOfDay, minute, second);
cal.getTime();//該方法調用就會拋出異常
}catch( Exception e ) {
ret = false;
}
return ret;
}