Here you can find the source of parseDate(String datetime)
public static Date parseDate(String datetime)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); public static Date parseDate(String datetime) { try {/*from w ww. j a v a2 s . co m*/ return DATE_FORMAT.parse(datetime); } catch (ParseException e) { return new Date(); } } public static Date parse(String datetime) { try { return FORMAT.parse(datetime); } catch (ParseException e) { return new Date(); } } }