Home > Enterprise >  How to write dates in Apache POI wich would be filtered properly
How to write dates in Apache POI wich would be filtered properly

Time:11-26

I have a block of code wich write data to .xlsx file. I need to write some date in "dd.MM.yy HH:MM" format. All is work properly, but when i try to open result file and test filter work, I got issue with that. Filter perceives dates just like strings, instead of dates, and i can't get filter with year and month.

Filter wich I want (in russian btw, sorry) enter image description here

CodePudding user response:

Looks like you didn't apply the style..?

if (cellValue instanceof Date) {
    cell.setCellValue((Date)cellValue);
    cell.setCellStyle(dateCellStyle);
}
  • Related