List of utility methods to do Hour Format
String | formatDate(Date d, String pattern, TimeZone tz) format Date SimpleDateFormat df = new SimpleDateFormat(pattern); df.setTimeZone(tz); return df.format(d); |
String | formatDate(Date d, TimeZone tz) format Date SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy HH:mm"); sdf.setTimeZone(tz); return sdf.format(d) + dateOffset(d, tz); |
String | formatDate(Date date, boolean includeTime) Method formatDate. if (date != null) { if (includeTime) return new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a").format(date); else return new SimpleDateFormat("MM/dd/yyyy").format(date); } else return null; |
String | formatDate(Date date, boolean time, boolean csv) returns the date in string format. StringBuilder sb = new StringBuilder(""); if (time) { if (csv) sb.append("MMM dd yyyy hh:mm a"); else sb.append("MMM dd, yyyy hh:mm a"); } else { if (csv) ... |
String | formatDate(Date date, boolean withTime) Formats a given date object to a standard date string. if (withTime) return new SimpleDateFormat(DATETIME_FORMAT).format(date); else return new SimpleDateFormat(DATE_FORMAT).format(date); |
String | formatDate(Date date, String dateFormat) format Date try { return new SimpleDateFormat(dateFormat).format(date); } catch (Exception e) { return ""; |
String | formatDate(Date date, String expression) format Date if (isEmpty(expression)) { expression = "yyyy-MM-dd HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(expression); return sdf.format(date); |
String | formatDate(Date date, String format) Format date by the format if (date == null) { return null; Format formatter = new SimpleDateFormat(format); return formatter.format(date); |
String | formatDate(Date date, String format) format Date if (format == null || "".equals(format)) { format = "yyyy-MM-dd HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); |
String | formatDate(Date date, String format) format Date SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); |