Free Support Forum - aspose.com

Reading Dates from a file created on a Mac

When reading a file with dates in it where the original document was created on a Mac using Excel, Aspose.Cells returns the wrong date.

Excel uses different numbers to represent dates depending on the OS used to create the file - see the attached file.

How can I get the correct date returned by Aspose.Cells?

Hi,

Thanks for the template files,

We will figure it out soon.

Thank you.

Hi,

We checked your file i.e. "mac_dates.xls", it is actually set as 1904 date system. (for confirmation, you may check in MS Excel: Click Tools|Options and Calculation tab). So, kindly uncheck the option i.e., "1904 date system" in the Calculation tab of the Options dialog box and Aspose.Cells will calculate it fine.

Thank you.

Thanks - but can this be done with Aspose (i.e. without needing to open in Excel and change the date system)?

Hi,

Yes, kindly use Workbook.Date1904 to set it to false for your need.

E.g.,

Workbook workbook = new Workbook();

workbook.Open("d:\\test\\mac_dates.xls");

Worksheet worksheet = workbook.Worksheets[0];

workbook.Date1904 = false;

.

.

Thank you.