Here you can find the source of parse2Date(SimpleDateFormat s, Object d)
public static Date parse2Date(SimpleDateFormat s, Object d)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date parse2Date(SimpleDateFormat s, Object d) { if (d instanceof String) { try { return s.parse(d.toString()); } catch (ParseException e) { return new Date(); }// w w w . jav a 2 s . c om } else if (d instanceof Date) { return (Date) d; } else { return new Date(); } } }