I have a query which returns date fields. I also have a function that returns the number of days between two given Calendars. My problem is how to get the value of a date into a Calendar. With: java.util.Date bdat = rs.getDate("bdat_ao"); bdat_ao = Calendar.getInstance(); bdat_ao.set(Calendar.YEAR, bdat.getYear()); I get the warning that bdat.getYear() is deprecated, which I knew but there doesnot seem to be any other way. Does anybody knows a way around this?