I have created a excel file using Aspose.Cells. The attached file “testfile.xlsx” is actually created using Aspose. The first column of the worksheet has datetimes. Please open the file in excel and click on any date. You will see all the dates have the same time “4:06:05 PM”.
Now, I open the same file and I’m trying to read the cell value using Aspose framework using the following code. But the Time value return from the code below is different. Check the “seconds” part of the time, instead of 05 it returns 04
Why???
public void ReadExcelCell()
{
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook("testfile.xlsx");
object A1 = wb.Worksheets[0].Cells["A1"].Value;
object A2 = wb.Worksheets[0].Cells["A2"].Value;
object A3 = wb.Worksheets[0].Cells["A3"].Value;
object A4 = wb.Worksheets[0].Cells["A4"].Value;
object A5 = wb.Worksheets[0].Cells["A5"].Value;
object A6 = wb.Worksheets[0].Cells["A6"].Value;
}
UPDATE: I just checked the database. In the database the time value for all these dates is “16:06:04.577”. This is the time value Apose used while creating the “testfile.xlsx” in the first place. So now question is why it does the rounding?