I have a date field which I am exporting to Excel using Java and Apache POI. I have set the Cell Style using the following:
private XSSFCellStyle dateFont = workbook.createCellStyle();
Font font = workbook.createFont();
font.setFontName("Calibri");
font.setFontHeightInPoints((short)12);
font.setItalic(true);
dateFont.setFont(font);
dateFont.setDataFormat(workbook.createDataFormat().getFormat("dd/MM/yyyy"));
The above piece of code correctly formats my date to the required format however in Excel the cell format shows as Custom (as shown in the image below).
What change do I need to make to the above code to allow me have the cell format as Date instead of Custom ?
Excepted Outcome :