I am trying to create a date that is a few years away from the current time. I am doing this like so:
new Date(Math.abs(System.currentTimeMillis() - 94670778000L));
However for some reason the year portion of the date becomes some random unknown number, causing the jvm to throw a MysqlDataTruncation exception. This is the full message:
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '55106056-02-25 05:40:34.461' for column 'lastSeenOnline' at row 1
According to serhii's post here: Data truncation: Incorrect datetime value: '' i should change the @Temporal annotation from TemporalType.TIMESTAMP to TemporalType.TIME. This does help but only because the date portion is then omitted, so this isn't the solution i'm looking for.
Can anyone tell me what i'm doing wrong? I am only initializing a new date via the millisecond constructor and it should work but it doesn't for some reason.