List of utility methods to do Date Format
String | FormatToString(Date date, String format) Format To String try { java.text.SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); } catch (Exception e) { e.printStackTrace(); return ""; |
String | FormatToString(String date, String format) Format To String try { Date dt = DateTimeHelper.ParseStringToDate(date); java.text.SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(dt); } catch (Exception e) { e.printStackTrace(); return date; ... |
String | ParseDateToString(Date date) Parse Date To String return ParseDateToString(date, "yyyy-MM-dd HH:mm:ss"); |
String | ParseDateToString(Date date, String format) Parse Date To String SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(date); |
String | date(Date date) date return format(date, "yyyy-MM-dd"); |
String | format(Date date) format return format(date, "yyyy-MM-dd HH:mm"); |
String | format(Date date, String format) format if (date == null || format == null) { return ""; DateFormat sdf = new SimpleDateFormat(format); return sdf.format(date); |
String | format(Date date, boolean isDateOnly) format if (isDateOnly) { return date(date); } else { return format(date); |
String | formatDA(Date d) format DA if (d == null) return null; Calendar c = new GregorianCalendar(); c.setTime(d); return formatDA(c, new StringBuffer(8)).toString(); |
String | formatDT(Date d) format DT if (d == null) return null; Calendar c = new GregorianCalendar(); c.setTime(d); StringBuffer sb = new StringBuffer(18); formatDA(c, sb); formatTM(c, sb); return sb.toString(); ... |