Here you can find the source of getSelectCalendar(String dateStr, String pattern)
public static Calendar getSelectCalendar(String dateStr, String pattern) throws ParseException
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Calendar getSelectCalendar(String dateStr, String pattern) throws ParseException { SimpleDateFormat formatter = new SimpleDateFormat(pattern); Date date = formatter.parse(dateStr); Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from ww w.ja v a 2s . c o m*/ return calendar; } }