The error timestamp format should be yyyy-mm-dd hh: mm: ss [.fffffffff], keeping the timestamp in the data file

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss a z");
String DateToStoreInDataBase= sdf.format(obj1.getSomeDate().toGregorianCalendar().getTime());

Timestamp ts = Timestamp.valueOf(emprSubDte);



sysout DateToStoreInDataBase is = "2014-19-13 12:19:59 PM EDT" when I try to save this result to the database when I get an error. The timestamp format should be yyyy-mm-dd hh: mm: ss [.fffffffff].

I have the same format but still I get the error.


source to share

2 answers

The problem is creating an instance of SimpleDateFormat. You are using this pattern: "yyyy-mm-dd hh: mm: ss a z"

The question is in the month. It should be "MM" instead of "mm". "mm" means "minute per hour".




check if an incompatible setter or getter exists , or shape your side of the database model, pageviews, and beans into xhtml mapping. I found the date value for the float and fixed it.



All Articles