I am working on a Java application and I have some problem trying to obtain the value of the year from a Date object.
So basically I have the following situation:
Basically into my code I have:
Date datePrimoVersamento = sdf.parse(mappaQuote.get(1).getDatariferimentoprezzo());
Date dateMovimentoFinale = sdf.parse(mappaQuote.get(0).getDatariferimentoprezzo());
System.out.println("datePrimoVersamento: " + datePrimoVersamento + " year: " + datePrimoVersamento.getYear());
System.out.println("dateMovimentoFinale: " + " year: " + dateMovimentoFinale.getYear());
The output is:
datePrimoVersamento: Fri Nov 27 00:00:00 CET 2015 year: 115
dateMovimentoFinale: Mon Oct 31 00:00:00 CET 2016 year: 116
As you can see the year of the 2 dates are 2015 an 2016 but the getYear() method returns to me 115 and 116.
Why? How is it possible? How can I fix this issue?