List of utility methods to do Calendar Format
String | formatDateTimeUTC(Calendar datetime) Format a date-time into UTC format. String ret = ""; int tt = 0; ret += datetime.get(Calendar.YEAR); tt = datetime.get(Calendar.MONTH) + 1; ret += tt < 10 ? "0" + tt : "" + tt; tt = datetime.get(Calendar.DAY_OF_MONTH); ret += (tt < 10 ? "0" + tt : "" + tt) + "T"; tt = datetime.get(Calendar.HOUR_OF_DAY); ... |
String | formatDay(java.util.Calendar d) format Day return yyyyMMdd.format(d.getTime());
|
String | formatDuration(Calendar t1, Calendar t2, boolean precise) format Duration return formatDuration(getDuration(t1, t2), precise);
|
String | formatRfc3339Calendar(Calendar cal) format Rfc Calendar return formatRfc3339Date(cal.getTime(), cal.getTimeZone());
|
void | formatTime(Calendar cal, StringBuffer sb) format Time int h = cal.get(Calendar.HOUR_OF_DAY); int m = cal.get(Calendar.MINUTE); int s = cal.get(Calendar.SECOND); int ms = cal.get(Calendar.MILLISECOND); if (h < 10) { sb.append('0'); sb.append(h); ... |
String | formatToHTTPDate(Calendar calendar) format To HTTP Date return String.format(Locale.ENGLISH, FORMAT_HTTPDATE, calendar);
|
String | getDate(Calendar cal, String dateFormat) get Date Calendar toUse = Calendar.getInstance(_locale); toUse.setTime(cal.getTime()); toUse.add(Calendar.MONTH, -1); SimpleDateFormat df = null; if (_dateFormatMap.get(dateFormat) != null) { df = (SimpleDateFormat) _dateFormatMap.get(dateFormat); } else { df = new SimpleDateFormat(dateFormat, _locale); ... |
String | getDate(Calendar cal, String dateFormat) get Date Calendar toUse = (Calendar) cal.clone(); toUse.add(Calendar.MONTH, -1); SimpleDateFormat df = new SimpleDateFormat(dateFormat); df.setLenient(true); return df.format(cal.getTime()); |
void | print(Calendar[] calendar)SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); System.out.print( " - FROM: " + sdf.format(calendar[0].getTime()) + " - TO: " + sdf.format(calendar[1].getTime())); |
void | printCalendar(Calendar cal) print Calendar if (cal != null) {
System.out.println(sdf2.format(cal.getTime()));
|