Here you can find the source of convertStringToCalendar(String time)
public static Calendar convertStringToCalendar(String time)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Calendar convertStringToCalendar(String time) { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendarDate = Calendar.getInstance(); Date dateObj = null;/*from w ww.j a v a2 s .c o m*/ try { dateObj = sdf.parse(time); calendarDate.setTime(dateObj); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return calendarDate; } }