Here you can find the source of parseDate(String str)
public static Date parseDate(String str)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static final String DATE_PATTERN = "yyyy-MM-dd"; public static final String DATETIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; public static Date parseDate(String str) { return parseDateTime(str, DATE_PATTERN); }/* w ww. java2s .c om*/ public static Date parseDateTime(String str) { return parseDateTime(str, DATETIME_PATTERN); } public static Date parseDateTime(String str, String pattern) { Date d = null; SimpleDateFormat sdf = new SimpleDateFormat(pattern); try { d = sdf.parse(str); } catch (ParseException e) { e.printStackTrace(); } return d; } }