Here you can find the source of parse(String str)
public static Date parse(String str)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; private static final String INIT_DATE_TIME = "1900-01-01 00:00:00"; public static Date parse(String str) { SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS); try {/*w w w . ja va 2 s.co m*/ if (str.length() < INIT_DATE_TIME.length()) { str += INIT_DATE_TIME.substring(str.length() + 1); } return sdf.parse(str); } catch (ParseException e) { return null; } } }