[Solved] Simple way to convert “yyyyMMdd”-formatted string into a GregorianCalendar object


You can use a SimpleDateFormat like so:

SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
Date date = format.parse("20150119");
Calendar calendar = GregorianCalendar.getInstance();
calendar.setTime(date);

solved Simple way to convert “yyyyMMdd”-formatted string into a GregorianCalendar object