List of utility methods to do Milliseconds
double | cyclesToMillis(long cycles, double hz) cycles To Millis return 1000 * ((double) cycles) / hz; |
String | dateToMillis(Date date) Formats a Date as a fifteen character long String made up of the Date's padded millisecond value. return zeroPadString(Long.toString(date.getTime()), 15);
|
String | dateToMillis(Date date) Formats a Date as a fifteen character long String made up of the Date's padded millisecond value. return zeroPadString(Long.toString(date.getTime()), 15);
|
String | dateToMillis(long now) save the datetime of System.currentTimeMillis() to dtatbase persistence. return zeroPadString(Long.toString(now), 15);
|
int | dayValue2Millisecond(int dayValue) 1 day = 1*24*60*60*1000 millisecond. return (dayValue * 24 * 60 * 60 * 1000);
|
int[] | decomposeMillis(long millis) Decompose millis into 0:days, 1:hours, 2:minutes, 3:seconds, 4:millis. final int[] result = new int[5]; result[4] = (int) (millis % 1000); long seconds = (millis / 1000); if (seconds == 0) return result; result[3] = (int) (seconds % 60); long minutes = (seconds / 60); if (minutes == 0) ... |
void | delayUntilNextSecond(int millis) delay Until Next Second long now = System.currentTimeMillis(); Calendar cal = Calendar.getInstance(); cal.setTime(new Date(now)); cal.set(Calendar.MILLISECOND, millis); cal.add(Calendar.SECOND, 1); long next = cal.getTime().getTime(); try { Thread.sleep(next - now); ... |
long | diffInMillis(long instantOne, long instantTwo) Diff is for instant, does not consider time zone return instantTwo - instantOne;
|
long | diffMillisec(String lhs, String rhs) diff Millisec synchronized (DATE_FORMAT) { Date l = DATE_FORMAT.parse(lhs); Date r = DATE_FORMAT.parse(rhs); return l.getTime() - r.getTime(); |
long | diffTimeInMillis(long start, long end) diff Time In Millis return end - start;
|