Here you can find the source of getCalendar(String str)
public static Calendar getCalendar(String str)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static Calendar getCalendar(String str) { int yy = Integer.parseInt(str.substring(0, 4)); int mm = Integer.parseInt(str.substring(4, 6)) - 1; int dd = Integer.parseInt(str.substring(6, 8)); Calendar cal = Calendar.getInstance(); cal.set(yy, mm, dd);/* w w w .ja v a 2 s . c om*/ return cal; } public static Calendar getCalendar(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal; } }