List of utility methods to do Time Passed
boolean | isConfilct(String begintimeOne, String endtimeOne, String begintimeTwo, String endtimeTwo) is Confilct Date beginOne = getFormatDate(begintimeOne);
Date endOne = getFormatDate(endtimeOne);
Date beginTwo = getFormatDate(begintimeTwo);
Date endTwo = getFormatDate(endtimeTwo);
if ((beginOne.compareTo(beginTwo) <= 0 && endOne.compareTo(beginTwo) >= 0)
|| (beginOne.compareTo(endTwo) <= 0 && endOne.compareTo(endTwo) >= 0)
|| (beginTwo.compareTo(beginOne) <= 0 && endTwo.compareTo(beginOne) >= 0)
|| (beginTwo.compareTo(endOne) <= 0 && endTwo.compareTo(endOne) >= 0)) {
...
|
boolean | isExpire(String strTime, String strExpiredTime) is Expire Date time = parse(strTime, FORMAT_NORMAL);
Date expiredTime = parse(strExpiredTime, FORMAT_NORMAL);
return (time.compareTo(expiredTime) >= 0);
|
boolean | isInBetweenTimes(String startTime, String endTime) is In Between Times Date nowTime = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); String time = sdf.format(nowTime); if (time.compareTo(startTime) >= 0 && time.compareTo(endTime) <= 0) { return true; } else { return false; |
boolean | isLimitTimeScope(String minTime, String maxTime) is Limit Time Scope SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); Date currentDate = new Date(); int current = currentDate.getHours() * 60 * 60 + currentDate.getMinutes() * 60 + currentDate.getSeconds(); Date minTargetTime = df.parse(minTime.trim()); int minTarget = minTargetTime.getHours() * 60 * 60 + minTargetTime.getMinutes() * 60 + minTargetTime.getSeconds(); Date maxTargetTime = df.parse(maxTime.trim()); int maxTarget = maxTargetTime.getHours() * 60 * 60 + maxTargetTime.getMinutes() * 60 ... |
void | printTimeElapsed(long starttime) print Time Elapsed long now = System.nanoTime(); System.out.println("elapsed time " + (now - starttime) / 1000 + " mi" + "" + "cro-secs"); |