我有問題以正確格式使用apache poi獲取日期3.7 根據文檔,我必須使用DataFormatter中的formatCellValue方法。 在這裏,我找到了一些建議相同的答案,但它不工作。Apache POI日期dd.MM.yyyy
Excel的字段顯示格式dd.MM.yyyy
日期:爲前:09.06.2010
使用formatCellValue(電池單元),我得到10年9月6日之後。 我嘗試DataFormatter和HSSFDataFormatter有和沒有Local.German或Local.German
這裏是我的代碼:
if(DateUtil.isCellDateFormatted(cell))
{
HSSFDataFormatter formatter = new HSSFDataFormatter(Locale.GERMAN);
String temp = formatter.formatCellValue(cell);
System.out.println(temp);
}
有人可以幫助我嗎?
「format dd-MM-yyyy:for ex:09.06.2010」 - 這沒有意義,因爲格式字符串和示例日期不兼容!你真正使用什麼格式的字符串? – Gagravarr
哦對不起, 我用dd.MM.yyyy – Rafael