List of utility methods to do Calendar Get
String | extractTimeFromCalendarTime(Calendar time) extract Time From Calendar Time SimpleDateFormat timeFormatter = new SimpleDateFormat("hh:mm a"); return timeFormatter.format(time.getTime()); |
Calendar | getCurrentCalendar() get Current Calendar Calendar currentCal = new GregorianCalendar(Locale.JAPAN); return currentCal; |
String | getCurrentDateByOffset(String format, int calendarField, int offset) get Current Date By Offset String mDateTime = null; try { SimpleDateFormat mSimpleDateFormat = new SimpleDateFormat( format); Calendar c = new GregorianCalendar(); c.add(calendarField, offset); mDateTime = mSimpleDateFormat.format(c.getTime()); } catch (Exception e) { ... |
Calendar | getCalenderFromDateString(String dateString) parse Date string like: "Sat Sep 21 23:39:40 +0800 2013" to java.util.Date object Calendar cal = Calendar.getInstance(); try { cal.setTime(weiboCreateDateFormat.parse(dateString)); } catch (ParseException e) { cal.setTime(new Date(0)); return cal; |