List of utility methods to do Hour Format
String | formatDate(Date date, String format) format Date if (date == null) return null; String str_date = null; if (format != null) { DateFormat formater = new SimpleDateFormat(format); str_date = formater.format(date); } else { str_date = datefmt.format(date); ... |
String | formatDate(Date date, String format) format Date return date != null && format != null ? new SimpleDateFormat(format).format(date) : null; |
String | formatDate(Date date, String format, Locale locale) format Date SimpleDateFormat sdf = new SimpleDateFormat(format, locale); return sdf.format(date); |
String | formatDate(Date date, String patter) format Date try { SimpleDateFormat sdf = new SimpleDateFormat(patter); return sdf.format(date); } catch (RuntimeException e) { return ""; |
String | formatDate(Date date, String pattern) format Date if (date == null) return ""; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return formatCalendar(calendar, pattern); |
String | formatDate(Date date, String pattern) Formats the given date according to the specified pattern. SimpleDateFormat formatter = new SimpleDateFormat(pattern, Locale.US); formatter.setTimeZone(GMT); return formatter.format(date); |
String | formatDate(Date date, String timeFormat, String timeZone) format Date SimpleDateFormat sdf = getDateFormatter(timeFormat); TimeZone ltz = TimeZone.getDefault(); Date nd = date; TimeZone tz = TimeZone.getTimeZone(timeZone); if (ltz.hasSameRules(tz) == false) { long lo = ltz.getRawOffset(); long to = tz.getRawOffset(); nd = new Date(date.getTime() - lo + to); ... |
void | formatDate(Date date, StringBuffer buffer) format Date ISO8601_FORMAT_OUT.format(date, buffer, new FieldPosition(0));
|
String | formatDate(Date date, TimeZone tz) Method description SimpleDateFormat sdf = new SimpleDateFormat(DATE_PATTERN); if (tz != null) { sdf.setTimeZone(tz); return sdf.format(date); |
String | formatDate(Date dateString) This function converts the current date string to appropirate database string representation try { SimpleDateFormat sdf = new SimpleDateFormat(); sdf.applyPattern("yyyy-MM-dd HH:mm:ss"); return sdf.format(dateString); } catch (Exception e) { e.printStackTrace(); return ""; ... |