We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Date cal wrong

Workbook wb = new Workbook("C:/Users/admin/Desktop/副本时间差.xlsx");
wb.save("C:/Users/admin/Desktop/副本时间差.html");


D9 display [31天7小时26分钟] in HTML but [0天7小时26分钟] in Excel


Hi,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue using the latest version Aspose.Cells
for Java v8.5.2.3
with the following sample code and found date calculation is wrong.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-41474 - Date calculation is wrong

I also used the Workbook.calculateFormula() but it did not change the results.

Java
String filePath = “F:/Shak-Data-RW/Downloads/s.xlsx”;

Workbook wb = new Workbook(filePath);
wb.calculateFormula();
wb.save(filePath + “.out.html”);

Hi,


We have evaluated your issue further.
Well, “0” is MS Excel’s odd behavior for formatting DateTime whose numeric value is less than 1. You can try to format value such as 0.36 to “yyyy-mm-dd” in MS Excel manually, then you will get the strange value i.e., “1900-01-00” where the day is “0”. That is also the formatted result you got by MS Excel for your situation. However, for us, I am afraid it is impossible to get the formatted day as “0” for any valid DateTime value by program. So we cannot give the same result as MS Excel does in that case.

Thanks for your understanding!