List of utility methods to do Second Calculate
long | computeStartOfNextSecond(long now) compute Start Of Next Second Calendar cal = Calendar.getInstance(); cal.setTime(new Date(now)); cal.set(Calendar.MILLISECOND, 0); cal.add(Calendar.SECOND, 1); return cal.getTime().getTime(); |
long | getMillisecond(long num, int unit) get Millisecond if (unit == Calendar.SECOND) { return num * 1000; } else if (unit == Calendar.MINUTE) { return num * 60 * 1000; } else if (unit == Calendar.HOUR_OF_DAY) { return num * 3600 * 1000; throw new IllegalArgumentException("unknown time unit: " + unit); ... |
int | getSecond(long t) get Second Calendar cld = Calendar.getInstance(); if (t > 0) { cld.setTime(new java.util.Date(t)); return cld.get(Calendar.SECOND); |
int | getSecond(String s) get Second if (s == null || s.length() < 18) { return 0; return Integer.parseInt(s.substring(16, 18)); |
Date | nextSecond(int second) next Second Calendar now = now();
now.set(Calendar.SECOND, now.get(Calendar.SECOND) + second);
return now.getTime();
|
Date | secondsLater(Integer seconds) Get date for number of seconds later return forCalendarDiff(Calendar.SECOND, seconds);
|