List of utility methods to do Hour Format
String | formatHour(String string) format Hour return (string.length() == 1) ? "0" + string : string; |
String | formatHour(int val) format Hour return formatHour(String.valueOf(val)); |
String | getReminderReadableTime(int hour, int minute) get Reminder Readable Time StringBuilder sb = new StringBuilder(); String period = " AM"; if (hour == 0) { hour = 12; period = " AM"; } else if (hour == 12) { period = " PM"; } else if (13 <= hour && hour <= 23) { ... |
int | getCurrentHour() get Current Hour Calendar c = Calendar.getInstance();
return c.get(Calendar.HOUR_OF_DAY);
|
String | getDateByAddHour(String datetime, int minute) get Date By Add Hour String returnTime = null; Calendar cal = new GregorianCalendar(); SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date; try { date = ft.parse(datetime); cal.setTime(date); cal.add(GregorianCalendar.MINUTE, minute); ... |
String | getDateByAddFltHour(float flt) get Date By Add Flt Hour int addMinute = (int) (flt * 60); Calendar cal = new GregorianCalendar(); cal.setTime(new Date()); cal.add(GregorianCalendar.MINUTE, addMinute); return getFormatDateTime(cal.getTime(), "yyyy-MM-dd HH:mm:ss"); |
String | homiToString(int hour, int minute) homi To String String ho = "12"; String mi = "00"; String pmam = "AM"; if (hour == 0) { ho = "12"; mi = Integer.toString(minute); pmam = "AM"; } else if (hour >= 1 && hour <= 11) { ... |
String | formatElapsedTime(StringBuilder recycle, String format, long hours, long minutes, long seconds) Fast formatting of h:mm:ss if (FAST_FORMAT_HMMSS.equals(format)) { StringBuilder sb = recycle; if (sb == null) { sb = new StringBuilder(8); } else { sb.setLength(0); sb.append(hours); ... |
String | time2String(int hour, int minute) Convert integer hour and minute to string format return String.format("%02d", hour) + ":" + String.format("%02d", minute); |