Year getting set 1970 when parse using SimpleDateFormat jdk1.4 -


simpledateformat formatobject = new simpledateformat("yyyy-mm-dd");    string attrvalue="2015-09-24";    date date = ((simpledateformat) formatobject).parse(attrvalue);     java.sql.date parsedvalue = new java.sql.date(date.gettime());     

randomly time prints parsedvalue 1970-09-24 sets year 1970 instead of 2015, if parse again same parse correctly 2015-09-24 not getting reason why time parse sets year 1970. using jdk1.4

try dateformat.setlenient(false); , watch out whether issue in java.util.date or java.sql.date.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -