Here you can find the source of parseString(String dateStr)
public static Calendar parseString(String dateStr) 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 String DEFAULTFORMAT = "yyyy-MM-dd HH:mm:ss"; public static Calendar parseString(String dateStr, String pattern) throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat(pattern); Date date = sdf.parse(dateStr); Calendar calendar = Calendar.getInstance(); calendar.setTime(date);// ww w. j a v a2s .co m return calendar; } public static Calendar parseString(String dateStr) throws ParseException { return parseString(dateStr, DEFAULTFORMAT); } }