List of utility methods to do Date Format
String | formatDate(Date date, String pattern) Formats a date into a date/time string using the default TimeZone for this host. return formatDate(date, pattern, TimeZone.getDefault());
|
String | formatDate(Date date, 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"); SimpleDateFormat formatter = DateFormatHolder.formatFor(pattern); return formatter.format(date); |
String | formatDate(Date date, 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"); SimpleDateFormat formatter = DateFormatHolder.formatFor(pattern); return formatter.format(date); |
String | formatDate(Date date, String pattern, TimeZone zone) Formats a date into a date/time string DateFormat dfmt = new SimpleDateFormat(pattern); dfmt.setTimeZone(zone); return dfmt.format(date); |
String | formatDate(Date time) Formats date to the string with default time date format. SimpleDateFormat dateformat = new SimpleDateFormat( DEFAULT_TIME_DATE_FORMAT); return dateformat.format(time); |
String | formatDate(SimpleDateFormat s, Date d) format Date return s.format(d);
|
String | formatDate(String date) format Date, "yyyy/MM/dd" SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATE_YYYY_MM_DD); String newKey; if (StringUtils.isEmpty(date) || date.equals("0")) { return ""; } else { newKey = date; Date dt = new Date(Long.parseLong(newKey)); ... |
String | formatDate(long millis) format Date if (millis == 0) return ""; SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATE_YYYY_MM_DD2); Date dt = new Date(millis); String sDateTime = null; sDateTime = sdf.format(dt); return sDateTime; |
String | formatDate1(String date) format Date, "yyyy-MM-dd" SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATE_YYYY_MM_DD); String newKey; if (StringUtils.isEmpty(date)) { newKey = ""; } else { newKey = date; Date dt = new Date(Long.parseLong(newKey)); ... |
String | formatDateAndTime(long millis) format Date And Time, "yyyy-MM-dd HH:mm" if (millis == 0) return ""; SimpleDateFormat sdf = new SimpleDateFormat( FORMAT_DATE_AND_TIME_YYYY_MM_DD_HH_MM); Date dt = new Date(millis); String sDateTime = null; sDateTime = sdf.format(dt); return sDateTime; ... |