List of utility methods to do Time Format
String | formatDateTime(String s) format Date Time if (!s.contains(" ")) return s; return s.trim().replace(" ", "T") + "Z"; |
String | formatDateTime(String value) format Date Time if (value == null) { return null; if (value.length() != DATE_TIME_STRING_LENGTH) { return addGMToffset(value); } else { return value; |
String | formatDateTimeString(final String dateTimeString, final boolean wrapForCodeUsage) format Date Time String if (wrapForCodeUsage) { return "date and time( \"" + dateTimeString + "\" )"; } else { return dateTimeString; |
String | formatDelay(long startTime, long endTime) format Delay final long delay = ((endTime - startTime) / 1000); final long sec = (delay / 1000000); final long usec = (delay % 1000000); return String.format("%d.%06d", sec, usec); |
String | formatElapsedTime(int seconds) format Elapsed Time String sPlural = (seconds == 1 ? "" : "s"); if (seconds < 60) return Integer.toString(seconds) + " second" + sPlural; int s = (seconds % 60); sPlural = (seconds == 1 ? "" : "s"); int m = seconds / 60; String mPlural = (m == 1 ? "" : "s"); return Integer.toString(m) + " minute" + mPlural ... |
String | formatElapsedTime(long elapsedTime) format Elapsed Time return String.format("%d:%02d:%02d", elapsedTime / 3600, (elapsedTime % 3600) / 60, (elapsedTime % 60)); |
String | formatElapsedTime(long time) format Elapsed Time long ms = time % 1000; time = time / 1000; long sec = time % 60; time = time / 60; long min = time % 60; time = time / 60; long hour = time % 24; time = time / 24; ... |
String | formatEndRowKeyString(String id, String timestampEnd) HBase takes in a string to end the scan at. String endRowKeyString = null; if (timestampEnd != null && timestampEnd != "") { timestampEnd = formatTimestampEnd(timestampEnd); } else { id = formatId(id); endRowKeyString = buildRowKeyFilterString(id, timestampEnd); return endRowKeyString; ... |
String | formatExecutionTime(long executionTime) Format execution time for log. long min = executionTime / (1000 * 60L); executionTime = executionTime - min * 1000 * 60L; long sec = executionTime / 1000L; long millis = executionTime - sec * 1000L; StringBuilder sb = new StringBuilder(); sb.append(min + " min. "); sb.append(sec + " sec. "); sb.append(millis + " millis"); ... |
String | formatExecutionTime(long ms) format Execution Time if (ms < 60000) { return String.valueOf(ms) + "ms"; long sec = ms / 1000; long min = sec / 60; sec -= min * 60; return String.valueOf(min) + " min " + String.valueOf(sec) + " sec"; |