I have a problem. I’m use Apache POI 3.8 and I needed set’s Date into Excel cell. But I don’t understand – how to set the date depending on the user locale. Because date in US format is month/day/year, in russian locale – day/year/month. I’m use next code for my task
CellStyle dateStyle = workbook.createCellStyle();
dateStyle.setDataFormat(dataFormat.getFormat("m/d/yy"));
cell.setCellStyle(dateStyle);
If anybody know – how to set’s cell Date value depending on the user locale, please, answer.
Note. If I’m use “m/d/yy h:mm”, then I not see my date in Excel file(I see only “######” string in cells).
Thank you.
Try and expand the cells. Sometimes if the cell width is too short
######is seen as the output. To get the localized pattern you can see this reference