Here is mainly their own personal development encountered some small problems, their own to save up, to make up for their weak Java foundation, the great God do not laughed at
1. DateFormat formatted HH and HH differences:
Public Static Booleancompare_date (String DATE1, String DATE2) {DateFormat df=NewSimpleDateFormat ("Yyyy-mm-dd HH:mm:ss"); Try{Date dt1=Df.parse (DATE1); Date DT2=Df.parse (DATE2); if(Dt1.gettime () <Dt2.gettime ()) { return true; } } Catch(Exception Exception) {exception.printstacktrace (); } return false; }
Previously written in a time-size method, occasionally found that it should be returned to Ture, but return false. Especially if one of them has a time of 12.
// 12-hour system New SimpleDateFormat ("Yyyy-mm-dd hh:mm:ss"); // 24-hour system New SimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");
Later found that he did not pay special attention to the meaning of HH and hh, paste copy, it was written as hh, self-confessed 12:30 will be translated into 00:30.
2. To be Continued ...
I will continue to update, I met, more embarrassing, but also to make their own unforgettable problems
Small white dots encountered in Java development