I am creating a Date object from a String in which the year is 2015123 and then trying to save it to Postgres. It's creating a Date object properly in the Java code but giving error timestamp out of range while saving it to the database.
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
Date date = sdf.parse("06/09/2015123"); // Here I inserted year 2015123.
It's converting a date object like this.
2015123-06-09 00:00:00.0
While I am trying to save it in Postgres it gives me an error.
timestamp out of range
I want to validate the Date object in java. Is there any possibility to validate in Java in spite of the Postgres error?