Here you can find the source of parseDate(Object str)
public static Date parseDate(Object str)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static String[] parsePatterns = { "yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM", "yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM", "yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM" }; public static Date parseDate(Object str) { if (str == null) { return null; }/*from w w w.ja va2 s . co m*/ try { return new SimpleDateFormat(parsePatterns[0]).parse(str.toString()); } catch (ParseException e) { return null; } } }