List of utility methods to do Hour Format
String | formatTime(Date time) Returns specified date in format "YYYY-MM-DD HH:MM:SS" (YYYY-year, MM-month, DD-day; HH-hour, MM-minutes, SS-seconds). Calendar calendar = Calendar.getInstance(); calendar.setTime(time); Formatter formatter = new Formatter(); formatter.format("%04d-%02d-%02d %02d:%02d:%02d", calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH) + 1, calendar.get(Calendar.DAY_OF_MONTH), calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND)); return formatter.toString(); |
String | formatTime(double s) formats time in seconds. String d = ""; if (s > 3600 * 24) { d = Integer.toString((int) (s / (3600 * 24))) + "d +"; s -= 3600 * 24; return d + dateFormat.get().format(new Date((long) s * 1000L - 3600000)); |
String | formatTime(final Calendar cal) format Time if (cal == null) { throw new NullPointerException("cal"); return formatTime(cal.getTime()); |
String | formatTime(final Date date) format Time final SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return df.format(date); |
String | formatTime(final long time) Formats a time and returns it as a String . return formatTime(DEFAULT_TIME_PATTERN, time);
|
String | formatTime(int msec, String format) Format a given number of miliseconds in a formatted time Note:if the time (in milliseconds) is smaller than ~month, it is calulated without a timezone) return formatTime((long) msec, format); |
String | formatTime(java.util.Date date) format Time if (date == null) { return ""; return format(date, "yyyy/MM/dd HH:mm:ss"); |
String | formatTime(long aTime) Format the time in milliseconds into a string in the format dd:hh:mm:ss long remainder = 0; long days = 0; long hours = 0; long minutes = 0; long seconds = 0; days = aTime / 86400000; remainder = aTime - (days * 86400000); hours = remainder / 3600000; ... |
String | formatTime(long ms) Given elapsed time in milliseconds, return a string formatted HH:MM:SS long h, m, s; s = ms / 1000; h = s / 3600; s = s - (h * 3600); m = s / 60; s = s - (m * 60); s = (s > 0 ? s : 1); java.text.NumberFormat time = new java.text.DecimalFormat("00"); ... |
String | formatTime(long time) Formats the time to the Docker-standard format. return formatDate(new Date(time)); |