Here you can find the source of parse(String date)
public static Date parse(String date)
//package com.java2s; //License from project: LGPL import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date parse(String date, String fromat) { try {/*from ww w.ja va 2 s .co m*/ return new SimpleDateFormat(fromat).parse(date); } catch (ParseException e) { return null; } } public static Date parse(String date) { try { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date); } catch (ParseException e1) { try { return new SimpleDateFormat("yyyyMMddHHmmss").parse(date); } catch (ParseException e2) { try { return new SimpleDateFormat("yyyy-MM-dd").parse(date); } catch (ParseException e3) { return null; } } } } }