List of utility methods to do Calendar Format
String | formatCalendar(Calendar calendar) format Calendar return formatDate(calendar.getTime());
|
String | formatCalendar(Calendar calendar) format Calendar final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS z"; SimpleDateFormat dateFormat = new SimpleDateFormat(DEFAULT_DATE_FORMAT); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat.format(calendar.getTime()); |
String | formatCalendar(Calendar calendar) Calendar to String format. if (calendar == null) return null; SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMddHHmmss"); DATE_FORMAT.setCalendar(calendar); return DATE_FORMAT.format(calendar.getTime()); |
String | formatCalendar(Calendar objCal, String strFormat) format Calendar if (objCal == null) { return null; } else { SimpleDateFormat formatter = new SimpleDateFormat(strFormat); return formatter.format(objCal.getTime()); |
String | formatCalendarTS(Calendar value) Formats the given value as a timestamp. if (value == null) { return ""; return new SimpleDateFormat(TS_FMT).format(value.getTime()); |
String | formatCalendarXsdZulu(Calendar c, int millisDigits) Format a Calendar object to a schema datetime string with time zone UTC Used by testConvertToDateTime(). String formatString = "yyyy-MM-dd'T'HH:mm:ss"; SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formatString); simpleDateFormat.setTimeZone(TimeZone.getTimeZone("GMT")); StringBuffer sb = new StringBuffer(simpleDateFormat.format(c.getTime())); sb.append(formatMillis(c.get(Calendar.MILLISECOND), millisDigits)); sb.append('Z'); return sb.toString(); |
String | formatDate(Calendar c) returns yyyy-mm-dd format for given calendar object if (c == null) return "??-??"; else return c.get(Calendar.YEAR) + "-" + String.format("%02d", (1 + c.get(Calendar.MONTH))) + "-" + String.format("%02d", c.get(Calendar.DAY_OF_MONTH)); |
String | formatDate(Calendar c) format Date return (new SimpleDateFormat("MM.dd.yy")).format(c.getTime()); |
String | formatDate(Calendar c) format Date if (c == null) return null; SimpleDateFormat df = new SimpleDateFormat(DATE_FORMAT); return df.format(c.getTime()); |
String | formatDate(Calendar cal) Format calendar date return new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(cal.getTime()); |