List of utility methods to do Milliseconds to Hour Convert
int | getHour(long dateTimeMillis) get Hour SimpleDateFormat format = new SimpleDateFormat("HH"); StringBuilder dateString = new StringBuilder( format.format(dateTimeMillis)); return Integer.parseInt(dateString.toString()); |
String | getHoursAndMinutes(long dateTimeMillis) get Hours And Minutes String format = String.format("%%0%dd", 2); long elapsedTime = dateTimeMillis / 1000; String minutes = String.format(format, (elapsedTime % 3600) / 60); String hours = String.format(format, elapsedTime / 3600); return hours + ":" + minutes; |