I have a piece of code here to calculate someone's age with the SQL date type in java. The code works fine, but however you can't see it in the code pasted here, but in my netbeans environment the get methods are crossed out, but only in this line:
LocalDate datumDB = LocalDate.of(gbdat.getYear() + 1900, gbdat.getMonth() + 1,
gbdat.getDate());
someone any idea why?
this line isn't crossed out:
int leeftijd = datumVanVandaag.getYear() - datumDB.getYear();
this is my code:
private void checkSpelerGeschiktVoorPloeg(Persoon p) {
Date gbdat = p.getGbDatum();
LocalDate datumVanVandaag = LocalDate.now();
LocalDate datumDB = LocalDate.of(gbdat.getYear() + 1900, gbdat.getMonth() + 1, gbdat.getDate());
int leeftijd = datumVanVandaag.getYear() - datumDB.getYear();
}