Here you can find the source of strToDate(String str, String format, java.util.Date defaultValue)
public static java.util.Date strToDate(String str, String format, java.util.Date defaultValue)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; public class Main { public static java.util.Date strToDate(String str, java.util.Date defaultValue) { return strToDate(str, "yyyy-MM-dd HH:mm:ss", defaultValue); }//from ww w . j ava2 s . c om public static java.util.Date strToDate(String str, String format, java.util.Date defaultValue) { SimpleDateFormat fmt = new SimpleDateFormat(format); try { defaultValue = fmt.parse(str); } catch (Exception localException) { } return defaultValue; } }