I have some problem trying to create a Date in Java, starting from the year, the month and the day.
So, I have created this simple utility method that creates my date:
private Date creaDataNascita(int birthYear, int birthMonth, int birthDay) {
Date dataNascita = new Date(birthYear, birthMonth, birthDay);
return dataNascita;
}
I have the following values for the input parameters (I checked it with the debugger.):
birthYear = 1984
birthMonth = 4
birthDay = 12
The problem is that this line:
Date dataNascita = new Date(birthYear, birthMonth, birthDay);
creates me a strange date, its value in fact is: 12-mag-3884.
Why? What is wrong? What am I missing? How can I fix this issue?