Android examples for java.util:Calendar Format
Parse string yyyyMMdd format To Calendar
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Calendar stringToCalendar(String datestring) { Calendar calendar = Calendar.getInstance(); SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); try {//from w w w . ja va 2 s . c o m Date date = df.parse(datestring); calendar.setTime(date); } catch (Exception e) { e.printStackTrace(); } return calendar; } }