I am trying to create a maximum date in my program with the following:
import java.util.Date;
import java.sql.Timestamp;
Date maxDate = new Date(Long.MAX_VALUE);
...
Timestamp ts = new Timestamp(maxDate.getTime());
If I am correct maxDate.getTime();
returns with the value of Long.MAX_VALUE
so it doesn't really matter, I could have written simply new Timestamp(Long.MAX_VALUE);
Am I right?
My problem is that my program gives the following exception at this point:
java.sql.SQLException: Year out of range.
So what is the maximum long value that can be passed to Timestamp? Or is there anything else I am missing here?
I am using an Oracle database if it matters.
Thanks in advance!