Java Utililty Methods Calendar Parse

List of utility methods to do Calendar Parse

Description

The list of methods to do Calendar Parse are organized into topic(s).

Method

CalendartoCalendar(String str)
to Calendar
Calendar cal = new GregorianCalendar();
Date date = null;
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try {
    date = sdf.parse(str);
    cal.setTime(date);
} catch (Exception e) {
    e.printStackTrace();
...
GregorianCalendartoGregorianCalendar(String value)
to Gregorian Calendar
Date d = new SimpleDateFormat().parse(value);
GregorianCalendar gc = new GregorianCalendar();
gc.setTime(d);
return gc;
CalendartoLocalCustomFormatCalendar(String calString, String format)
to Local Custom Format Calendar
Calendar localCal = Calendar.getInstance();
localCal.setTime(new SimpleDateFormat(format).parse(calString));
return localCal;