Here you can find the source of getCalendarByDay(String dayStr)
public static Calendar getCalendarByDay(String dayStr) throws ParseException
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static DateFormat yyyyMMddFormat = new SimpleDateFormat("yyyyMMdd"); public static Calendar getCalendarByDay(String dayStr) throws ParseException { Calendar calendar = Calendar.getInstance(); Date date = yyyyMMddFormat.parse(dayStr); calendar.setTime(date);/* w ww .jav a2s . c om*/ return calendar; } }