List of utility methods to do Date Format
String | dateFormat(Date date, String format) Retorna uma data formatada conforme String format passado SimpleDateFormat sf = new SimpleDateFormat(format); return sf.format(date); |
String | dateFormat(Date date, String pattern) date Format if (date == null || isNullString(pattern)) { return ""; SimpleDateFormat format = new SimpleDateFormat(pattern); return format.format(date); |
String | dateFormat(Date date, String pattern) date Format if (pattern == null || "".equals(pattern.trim())) { pattern = DATE_PATTERN; SimpleDateFormat sdf = new SimpleDateFormat(pattern); return sdf.format(date); |
String | dateFormat(Date date, String pattern) date Format SimpleDateFormat df = new SimpleDateFormat(pattern); return df.format(date); |
String | dateFormat(DateFormat f, Date d) Formats a Date into a date/time string. synchronized (f) { return f.format(d); |
DateFormat | dateFormat(int grain, TimeZone timeZone) date Format SimpleDateFormat result = dateFormat(grain); if (timeZone != null) { result = new SimpleDateFormat(result.toPattern()); result.setTimeZone(timeZone); return result; |
String | dateFormat(java.util.Date date, String formatStr) date Format java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(formatStr); return sdf.format(date); |
String | dateFormat(long time) date Format return dateFormat(new Date(time)); |
Date | dateFormat(String date, String dateFormat) date Format if (date == null) return null; SimpleDateFormat format = new SimpleDateFormat(dateFormat); if (date != null) try { return format.parse(date); } catch (Exception ex) { return null; |
String | DateFormat(String dateStr, String oldPattern, String newPattern) Date Format SimpleDateFormat sdf = new SimpleDateFormat(oldPattern); Date date = null; try { date = sdf.parse(dateStr); } catch (ParseException e) { e.printStackTrace(); return ""; return new SimpleDateFormat(newPattern).format(date); |