List of utility methods to do Time Format
String | calFormatTime(final Calendar cal) Formats a Calendar to the application wide format for time SimpleDateFormat sdf = new SimpleDateFormat(TIME_FORMAT); return sdf.format(cal.getTime()); |
boolean | compareTime(String time1, String time2, String dateFormat) compare Time SimpleDateFormat t1 = new SimpleDateFormat(dateFormat); SimpleDateFormat t2 = new SimpleDateFormat(dateFormat); try { Date d1 = t1.parse(time1); Date d2 = t2.parse(time2); return d1.before(d2); } catch (Exception e) { e.printStackTrace(); ... |
DateFormat | createTimeFormatter(String languageCode) create Time Formatter DateFormat formatter = null; if ((languageCode != null) && !("".equalsIgnoreCase(languageCode.trim()))) { languageCode = languageCode.trim(); Locale locale = new Locale(languageCode.substring(2, 4).toLowerCase(), languageCode.substring(0, 2)); formatter = DateFormat.getTimeInstance(DateFormat.SHORT, locale); } else { formatter = DateFormat.getTimeInstance(DateFormat.SHORT); return formatter; |
String | format(long time) format if (-60000 < time && time < 60000) { return formatSeconds(time); if (time == Long.MAX_VALUE) { return "DNF"; String sign = ""; if (time < 0) { ... |
String | format(long time) format return String.valueOf(time) + " in game ticks."; |
String | format(long time, String timerPrecisionId, boolean round) format if (-60000 < time && time < 60000) { return formatSeconds(time, timerPrecisionId, round); String result = ""; if (time == Long.MAX_VALUE) { return "DNF"; String sign = ""; ... |
String | format(String format, long time) format long seconds = (time / 1000) % 60; long minutes = (time / (1000 * 60)) % 60; long hours = (time / (1000 * 60 * 60)) % 24; return String.format(format, hours, minutes, seconds); |
String | formatBenchResult(final String benchName, final int iterationCount, final int benchNumber, final double benchTime) format Bench Result return benchName + " | repeat: " + benchNumber + " | iterationCount: " + iterationCount + " | time: " + benchTime; |
String | formatCooldown(long time) format Cooldown long hours = time / 3600; long minutes = (time % 3600) / 60; long seconds = time % 60; String currentCooldown = ""; if (hours > 0) { currentCooldown = String.format("%dh %dm %ds", hours, minutes, seconds); } else if (minutes > 0) { currentCooldown = String.format("%dm %ds", minutes, seconds); ... |
String | formatDateTime(String DateTimeStr) format Date Time if (DateTimeStr != null) { return "{ts '" + DateTimeStr + "'}"; } else { return null; |