List of utility methods to do Second Compare
boolean | compareDate(Date firstDate, Date secondDate) compare Date if (firstDate == null || secondDate == null) { throw new java.lang.RuntimeException(); String strFirstDate = date2String(firstDate, "yyyy-MM-dd"); String strSecondDate = date2String(secondDate, "yyyy-MM-dd"); if (strFirstDate.equals(strSecondDate)) { return true; return false; |
int | compareIgnoreSecond(Date date, Date anotherDate) compare Ignore Second if (date == null) { date = new Date(); if (anotherDate == null) { anotherDate = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(date); ... |
Integer | getSecondBetweenDate(Date d1, Date d2) get Second Between Date Long second = (d2.getTime() - d1.getTime()) / 1000;
return second.intValue();
|
long | getSecondCa(Date d1, Date d2) get Second Ca long quot = Math.abs(d1.getTime() - d2.getTime()); quot = quot / 1000; return quot; |
long | getSecondsOfTowDiffDate(String p_startDate, String p_endDate) get Seconds Of Tow Diff Date return (long) getMillisOfTowDiffDate(p_startDate, p_endDate) / 1000; |
int | secondBetween(String date) second Between SimpleDateFormat sdfSecond = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { long presentDate = sdfSecond.parse(sdfSecond.format(new Date())).getTime(); long enterDate = sdfSecond.parse(date).getTime(); return (int) ((presentDate - enterDate) / 1000); } catch (ParseException e) { e.printStackTrace(); return 1; |
long | secondOfDate(Date d1, Date d2) second Of Date SimpleDateFormat fDate = new java.text.SimpleDateFormat("yyyyMMddHHmmss"); long l_d1 = Long.valueOf(fDate.format(d1)); long l_d2 = Long.valueOf(fDate.format(d2)); return l_d1 - l_d2; |
Date | setSeconds(Date date, int amount) Sets the seconds field to a date returning a new object. return set(date, Calendar.SECOND, amount);
|