hibernate - date format issue string to java util date -
i new date functions. have date string '03/10/2014' - month/date/year. need convert '10-mar-14' util date format. how can please me.
i used 'mm/dd/yyy' , '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 + "' date mask '" + amask + "'"); } try { date = df.parse(strdate); } catch (parseexception pe) { //log.error("parseexception: " + pe); throw new parseexception(pe.getmessage(), pe.geterroroffset()); } return (date);
to this. gives me parse exception. appreciate help
but database column has date-month-year eg: 09-mar-14. not give result. need conversion hibernate criteria search. database has results. conversion not give results.
you missed y
in expression, use mm/dd/yyyy
Comments
Post a Comment