Set Date format using Apache POI

后端 未结 2 1818
情深已故
情深已故 2021-02-19 04:58

I want to set date in date format in excel file with Apache POI. The value will set in such a manner so that in Address Bar it will show in mm/dd/YYYY and in cell it will show i

2条回答
  •  野性不改
    2021-02-19 05:29

    Best approach is:

    HSSFDataFormatter hdf = new HSSFDataFormatter();
    System.out.println (hdf.formatCellValue(mycell));
    

    This worked completely fine with me. This piece of code simply returns the cell in its raw form, no change at all in its format.

提交回复
热议问题