parsing dates in java -


i have date stored in database string 14/08/2010. want parse date in order compare current date. did doesn't compile don't know why:

try{       date = new simpledateformat("dd/mmm/yyyy").parse(rs.getstring(2));       system.out.println(rs.getstring(2)); }catch(parseexception s){       s.printstacktrace(); } 

it prints error:

java.text.parseexception: unparseable date: "14/08/2010" 

i tried changing date format dd/mm/yyyy have same problem.

you should use dd/mm/yyyy per date string 14/08/2010

mmm matches month name such jan , feb

read more simpledateformat patterns


i tried

date date = new simpledateformat("dd/mmm/yyyy").parse("14/08/2010"); 

that results

exception in thread "main" java.text.parseexception: unparseable date: "14/08/2010"     @ java.text.dateformat.parse(unknown source) 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -