I am new to Date functions. i have a date as a string '03/10/2014' - month/date/year. i need to convert this like '10-MAR-14' util date format. How can i do this please help me.
i used 'MM/dd/yyy' and 'dd-MMM-yyy' formats.
public static Date convertStringToDate(String aMask, String strDate)
throws ParseException {
SimpleDateFormat df;
Date date;
df = new SimpleDateFormat(aMask);
if (log.isDebugEnabled()) {
log.debug("converting '" + strDate + "' to date with mask '" + aMask + "'");
}
try {
date = df.parse(strDate);
} catch (ParseException pe) {
//log.error("ParseException: " + pe);
throw new ParseException(pe.getMessage(), pe.getErrorOffset());
}
return (date);
to do this. but gives me parse exception. Appreciate your help
but database column has the date-Month-year eg: 09-MAR-14. this does not give the result. i need to this conversion for hibernate criteria search. Database has results. but this conversion does not give the results.