java - Wrong Date inserted in Date column -
I have a strange situation
In my application we present the current date (MM / DD / YY) Are putting a record with when users are using something in the application.
Sometimes the date is being included with the wrong value, which is not the current date. (Ie: '21 / 09/2014 ', '13 / 09/2180', '22 / 08/2179 '). We are using JPA to record records from Java. Please help me find the problem or the solution for it.
Below is the code, where I am preparing / passing the value for the domain object.
date curDate = new date (); SimpleDetformSDF = New SimpleDetermate ("MM / DD / Yay"); UserAccessObj.setAccessedDate (sdf.parse (SDF format) (curDate)); Here is the java.util.Date setter method in the setAccessedDate (date) domain object. So, what can be the problem? I am unable to locate this issue.
instead:
UserAccessObj.setAccessedDate (sdf.parse ( Sdf.format (curDate)); Try it out:
UserAccessObj.setAccessedDate (curDate);
Comments
Post a Comment