List of utility methods to do Time Format
String | formatTimeDiff(long finishTime, long startTime) Given a finish and start time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec, for the time difference between two times. long timeDiff = finishTime - startTime; return formatTime(timeDiff); |
String | formatTimeDiff(long finishTime, long startTime) Given a finish and start time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec, for the time difference between two times. StringBuffer buf = new StringBuffer(); long timeDiff = finishTime - startTime; long hours = timeDiff / (60 * 60 * 1000); long rem = (timeDiff % (60 * 60 * 1000)); long minutes = rem / (60 * 1000); rem = rem % (60 * 1000); long seconds = rem / 1000; if (hours != 0) { ... |
String | formatTimeDifference(long ms) format Time Difference if (ms < 1000) { return "< 1 second"; long seconds = ms / 1000; if (seconds < 60) { return ((int) seconds) + " seconds"; int minutes = (int) seconds / 60; ... |
String | formatTimeDifference(long time1, long time2) format Time Difference return formatTime(getTimeDifference(time1, time2));
|
String | formatTimeDigital(int time) format Time Digital int mins = time / 60; int secondsInteger = time % 60; String seconds = String.valueOf(secondsInteger); if (seconds.length() == 1) { seconds = "0" + seconds; return mins + ":" + seconds; |
String | formatTimeDuringHour(long mss) format Time During Hour long days = mss / 3600000L; return days + ""; |
String | formatTimeElapsed(long p_millis) format elapsed time from millisecond to human readable format p_millis /= (1000 * 60); return "" + (p_millis / 60) + "h" + (p_millis % 60); |
String | formatTimeInfo(long time) Get size info String info = ""; long ms = (long) time; int i = 1000; int value = (int) ms % i; info = value + " millisecond(s)"; ms /= i; if (ms > 0) { i = 60; ... |
String | formatTimeInMilisec(long time) format Time In Milisec if (time / 1000 < 1) { return "0 seconds"; long inMinutes = time / 60000; long hours = inMinutes / 60; String formatedTime = ""; if (hours > 0) { String unit = hours > 1 ? "hours" : "hour"; ... |
String | formatTimeInNanos(long time) format Time In Nanos return formatDecimal(nanosToMillis(time));
|