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

Free Support Forum - aspose.com

Aspose.cell Java duration format

Hi,

I am using Aspose.cell for java and plotting various kind of chart.I am facing issue while trying to plot duration. let say I have duration of 86400 seconds i.e cell should show 24:00:00 but it is showing 00:00:00 and when i select cell it shows 20/07/2136 12:00:00 AM.

I am expecting it should show only 24:00:00 in both place. Kindly help me on this.

Her is my code :-
Cell cell = cells.get(0,0).setValue(86400)
Style style =  cells.get(0,0).getStyle();
style.setCustom(“hh:mm:ss”);
cells.get(0,0).setStyle(style);

Thanks in Advance
Chandan



Hi Chandan,


Thank you for contacting Aspose support.

If you try this scenario in Excel, you will notice that the result is identical to Aspose.Cells’ result. This is because Aspose.Cells APIs follow Excel’s guidelines and specifications in its processes, whereas in Excel 1.0 equals 1 full day (starting since 1/1/1900). When you specify 86400, you are actually specifying the number of days since 1/1/1900, that is; (86400/365)+1900=2136. Moreover, 1 second = 1 / 86400, that is; the number of seconds in a day.

By the way, your specified format is correct, however, you need to adjust the value as per above discussion to get desired results.

Thank you so much. It’s working now.

Hi Chandan,


It is good to know that you are up & running. Please feel free to contact us back in case you need our further assistance with Aspose APIs.