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
Post a Comment