List of utility methods to do Calendar Format
String | formateCalDavDue(Calendar c) formate Cal Dav Due return c == null ? null : caldavDueFormat.format(c.getTime());
|
String | getUniversalDateStamp(Calendar cal) Get current time stamp in universal format Format: yyyy-mm-ddThh:mm:ssZ e.g.: 1999-09-09T13:10:40Z String year = String.valueOf(cal.get(Calendar.YEAR)); String month = String.valueOf(cal.get(Calendar.MONTH) + 1); if (month.length() == 1) { month = "0" + month; String day = String.valueOf(cal.get(Calendar.DAY_OF_MONTH)); if (day.length() == 1) { day = "0" + day; ... |
String | getFormattedTime(Context context, Calendar time) get Formatted Time String skeleton = DateFormat.is24HourFormat(context) ? "EHm" : "Ehma"; String pattern = DateFormat.getBestDateTimePattern( Locale.getDefault(), skeleton); return (String) DateFormat.format(pattern, time); |
String | getFormattedTime(Context context, Calendar time) get Formatted Time String skeleton = DateFormat.is24HourFormat(context) ? "EHm" : "Ehma"; String pattern = DateFormat.getBestDateTimePattern( Locale.getDefault(), skeleton); return (String) DateFormat.format(pattern, time); |
String | calendar2string(Calendar calendar, String formatString) calendarstring return new SimpleDateFormat(formatString) .format(calendar.getTime()); |
String | format(Calendar cal, String format, Locale locale) format SimpleDateFormat formatter = new SimpleDateFormat(format, locale); return formatter.format(cal.getTime()); |
Calendar | getCalendarFromDateString(String dateString, String format, Locale locale) get Calendar From Date String SimpleDateFormat formatter = new SimpleDateFormat(format, locale); Calendar cal = Calendar.getInstance(); try { cal.setTime(formatter.parse(dateString)); } catch (ParseException e) { DebugLog.e("ParseException"); return null; return cal; |
String | getFormatedDate(Calendar c, String format) get Formated Date try { Date d = new Date(c.getTimeInMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat(format); return dateFormat.format(d); } catch (Exception e) { return new String(); |
Calendar | string2calendar(String s, String formatString) stringcalendar Calendar calendar = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(formatString); Date d = null; try { d = sdf.parse(s); } catch (ParseException ignore) { calendar.setTime(d); ... |
String | toSimpleDate(Calendar calendar, String format) Format a calendar date to a string with a certain format. SimpleDateFormat simpleDate = new SimpleDateFormat(format); String simpleDateString = simpleDate.format(calendar.getTime()); return simpleDateString; |