List of utility methods to do Date Compare
boolean | compareDate(String date1, String date2) compare Date try { Date d1 = formatter.parse(date1); Date d2 = formatter.parse(date2); return !d1.after(d2); } catch (ParseException e) { e.printStackTrace(); return false; |
boolean | compareDate(String s, String e) compare Date if (fomatDate(s) == null || fomatDate(e) == null) { return false; return fomatDate(s).getTime() >= fomatDate(e).getTime(); |
boolean | compareDate(String s, String e) compare Date if (parseDate(s) == null || parseDate(e) == null) { return false; return parseDate(s).getTime() >= parseDate(e).getTime(); |
int | compareDate(String sDate, String eDate, String formatStr) compare Date Date startDate = strToDate(sDate, formatStr);
Date endDate = strToDate(eDate, formatStr);
return compareDate(startDate, endDate);
|
long | compareDate(String sFirstDate, String sSecondDate) compare Date long time1 = convertDateTimeToSysTime(sFirstDate); long time2 = convertDateTimeToSysTime(sSecondDate); long nTime = (time1 - time2); final long nConst = (24 * 60 * 60 * 1000); if (nTime % nConst == 0) { return nTime / nConst; return (nTime / nConst) + 1; ... |
boolean | compareDate(String startdate, String enddate) compare Date SimpleDateFormat formatter = new SimpleDateFormat(DEF_DATE_FORMAT); Date sd = formatter.parse(startdate, new ParsePosition(0)); Date ed = formatter.parse(enddate, new ParsePosition(0)); return sd.before(ed); |
int | compareDate(String startDate, String endDate, String strFormat) compare Date java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat(strFormat); Calendar start = Calendar.getInstance(); Date tempstartdate; Calendar end = null; try { tempstartdate = formatter.parse(startDate); start.setTime(tempstartdate); end = Calendar.getInstance(); ... |
boolean | compareDate(String strDate1, String strDate2, String format) compare Date Date date1 = convertStrToDate(strDate1, format); Date date2 = convertStrToDate(strDate2, format); if (date1.getTime() >= date2.getTime()) return true; return false; |
boolean | compareDate2(String begingDate, String endDate, String format) compare Date boolean boo = true; Date begin = null; Date end = null; if (format.isEmpty()) { format = format = "yyyy/MM/dd"; DateFormat df = new SimpleDateFormat(format); if (null == begingDate || "".equals(begingDate)) { ... |
boolean | compareDateFormat(String strDate1, String strDate2, String format) compare Date Format Date date1 = convertStrToDate(strDate1, format); Date date2 = convertStrToDate(strDate2, format); if (date1.getTime() > date2.getTime()) { return true; return false; |