Here you can find the source of toDate(Object object)
public static Date toDate(Object object)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date toDate(Object object) { String in = object.toString(); Date date;/*from w w w . j a va2 s . c o m*/ DateFormat formater = new SimpleDateFormat("yyyy-MM-dd"); try { date = formater.parse(in); return date; } catch (ParseException e) { return null; } } }