List of utility methods to do Hour Format
String | formatDate(Date src, String formatPattern) format Date if (src == null) { return ""; DateFormat fmt = new SimpleDateFormat(formatPattern); return fmt.format(src); |
String | formatDate(final Date date, final String pattern) Formats the given date according to the specified pattern. if (date == null) throw new IllegalArgumentException("date is null"); if (pattern == null) throw new IllegalArgumentException("pattern is null"); final SimpleDateFormat formatter = new SimpleDateFormat(pattern, Locale.US); formatter.setTimeZone(GMT); return formatter.format(date); |
String | formatDate(final Date date, String pattern) format date by given pattern if (date == null) { return null; if (pattern == null) { pattern = DEFAULT_PATTERN; final SimpleDateFormat formatter = new SimpleDateFormat(pattern); return formatter.format(date); ... |
String | formatDate(final String date) format Date if (date.isEmpty()) return date; DateFormat df = new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy"); Date formattedDate = df.parse(date); return formatedDateWithTime(formattedDate); |
String | formatDate(java.util.Date date, String pattern) format Date SimpleDateFormat formatterOut = new SimpleDateFormat(pattern); return formatterOut.format(date); |
String | formatDate(java.util.Date dtFormat, String sFormatString) Format dates, convenience method return formatDate(dtFormat, sFormatString, Locale.getDefault(), TimeZone.getDefault());
|
String | formatDate(Object obj, String format) format Date if (obj == null || obj.toString() == "") { return ""; SimpleDateFormat dateFormat = null; if (DAY_STR.equals(format)) { dateFormat = DAY_FORMAT; } else if (TIME_STR.equals(format)) { dateFormat = TIME_FORMAT; ... |
Date | formatDate(String date) format Date return format(date, "yyyy-MM-dd"); |
String | formatDate(String date) format Date String str = ""; if (date == null || date.equals("")) { str = ""; } else if (date.length() >= 10) { str = date.substring(0, 10); } else { str = date; return str; |
String | formatDate(String dateTimeString) Extracts date and month from dateTimeString and formats SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); Date date = null; try { date = dateFormat.parse(dateTimeString); } catch (ParseException e) { e.printStackTrace(); Calendar cal = Calendar.getInstance(); ... |