I have problems to get date in right format using apache poi 3.7 According the documentation I have to use the formatCellValue Method from DataFormatter. Here I found a few answers which advise the same, but it don´t works.
The excel field shows the date in format dd.MM.yyyy
: for ex: 09.06.2010
After using formatCellValue(Cell cell) I get 9/6/10. I try DataFormatter and HSSFDataFormatter with and without Local.German or Local.German
Here is my code:
if( DateUtil.isCellDateFormatted(cell))
{
HSSFDataFormatter formatter = new HSSFDataFormatter(Locale.GERMAN);
String temp = formatter.formatCellValue(cell);
System.out.println(temp);
}
Can somebody help me?
I'm not certain, but I think the issue might be that you've overridden the format string of one of the default date formats.
This was only fixed in POI 3.8 beta 1 (see the changelog), so I'd suggest you try upgrading to 3.8 beta3 and it will hopefully fix your issue. Previously POI just assumed that the default formats wouldn't have been changed, so would use the default format string for them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With