Here you can find the source of getDateFromString(String stringDate)
public static Calendar getDateFromString(String stringDate)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; public class Main { public static Calendar getDateFromString(String stringDate) { //format expected YYYYMMDD Calendar calendar = Calendar.getInstance(); calendar.set(new Integer(stringDate.substring(0, 4)), new Integer(stringDate.substring(4, 6)) - 1, new Integer(stringDate.substring(6, 8)), 0, 0, 0); return calendar; }/*from w ww. j a v a 2 s . c om*/ }