Here you can find the source of parseString(String dateStr)
public static Calendar parseString(String dateStr) throws ParseException
//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 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);//from w w w . j ava2s.c om return calendar; } public static Calendar parseString(String dateStr) throws ParseException { return parseString(dateStr, DEFAULTFORMAT); } }