Read date from excel using apache poi in java

Read date from excel using apache poi in java:

import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.*;
//declarations and class stuff

public Date readDateFromRowOnIndex(Row currentRow, Workbook workbook, int index){
	FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator();
	Cell currentCell = currentRow.getCell(index);
	CellValue cellValue = evaluator.evaluate(currentCell);
	if (cellValue.getCellType() == CellType.NUMERIC) {
		if (HSSFDateUtil.isCellDateFormatted(currentCell)) {
			Date d = currentCell.getDateCellValue();
			return d;
		}
	}
	return null;
}

The Date is formatted as a number

Maven dependencies:

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>4.0.0</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml</artifactId>
    <version>4.0.0</version>
</dependency>
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi-ooxml-schemas</artifactId>
    <version>4.0.0</version>
</dependency>