/****************************************************************
* Desc : It convert the given String to Date object based on the given format.
* @return java.util.Date
***************************************************************/
public static java.util.Date stringToDate(String userDate, String format)
{
if (userDate != null)
{
DateFormat df = new SimpleDateFormat(format);
try {
java.util.Date date = df.parse(userDate);
return date;
}
catch (ParseException pe) {
pe.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
* Desc : It convert the given String to Date object based on the given format.
* @return java.util.Date
***************************************************************/
public static java.util.Date stringToDate(String userDate, String format)
{
if (userDate != null)
{
DateFormat df = new SimpleDateFormat(format);
try {
java.util.Date date = df.parse(userDate);
return date;
}
catch (ParseException pe) {
pe.printStackTrace();
}
catch (Exception e) {
e.printStackTrace();
}
}
return null;
}