I have been trying to convert excel date to Java date using POI , the file format is .xlsx. Date and Month is are correct when converted to java but year is displaying 1900 instead of 1968, tried all possible solution mentioned here but no luck, below is the code:
DateFormat dateOfBirthformat = new SimpleDateFormat("yyyy-MM-dd");
Date dateOFBirth = null;
if (DateUtil.isCellDateFormatted(row.getCell(13)) && DateUtil.isValidExcelDate(row.getCell(13).getNumericCellValue())) {
dateOFBirth = row.getCell(13).getDateCellValue();
}
XMLGregorianCalendar dob = DatatypeFactory.newInstance().newXMLGregorianCalendar(dateOfBirthformat.format(dateOFBirth));
personalInfo.setDOB(dob);