List of utility methods to do Hour Format
String | formatDate(String format) format Date return formatDate(format, new Date()); |
String | formatDate(String inputStr) format Date SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { return sdf.format(sdf.parse(inputStr)); } catch (ParseException e) { e.printStackTrace(); return ""; |
String | formatDate(String pattern, Date date) Formats a java.util.Date object into a string according to a specified pattern. SimpleDateFormat formatter = new SimpleDateFormat(pattern); return formatter.format(date); |
String | formatDate2DateTimeStr() Format the current date time to "yyyy-MM-dd HH:mm:ss" format string. return formatDate2DateTimeStr(new Date()); |
String | formatDate2DateTimeStr() Format the current date time to "yyyy-MM-dd HH:mm:ss" format string. return formatDate2DateTimeStr(new Date()); |
String | formatDate3DateTimeStr(Date date) format Date Date Time Str SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return s.format(date); |
String | formatDateAddHMS(String strDate) format Date Add HMS String strNewDate = ""; if (strDate != null && strDate.length() > 8) { if (strDate.length() <= 14) { strNewDate = strDate; } else { strNewDate = strDate.substring(0, 14); } else { ... |
String | formatDateAndTime(Date date) Format date and time. SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); return sd.format(date); |
String | formatDateAsString(Date date) format Date As String SimpleDateFormat formatter = new SimpleDateFormat("MMM d, Y @ hh:mma"); DateFormatSymbols symbols = new DateFormatSymbols(Locale.getDefault()); symbols.setAmPmStrings(new String[] { "am", "pm" }); formatter.setDateFormatSymbols(symbols); return formatter.format(date); |
String | formatDateForCERMe(Date date, boolean includeTime) Method formatDateForCERMe. 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; |