Free Support Forum -

ASPOSE.Cells for Java BuiltInDocumentProperties.getLastSavedBy() returns wrong day & time

BuiltInDocumentProperties.getCreatedTime() returns the right date but the time is off by 1 hour. This could just be a daylight savings time quirk in Excel.

BuiltInDocumentProperties.getLastSavedBy() returns the right month and year but the day and time are way off. This is my main problem having the day wrong and the time not within 1 hour.

My Excel 2003 file properties shows:
Created: September 18, 2007 8:21:58 AM
Modified: November 24, 2007 2:04:12 PM

BuiltInDocumentProperties returns:

Created: Sep 18 09:21:58 PDT 2007 (hour is off by 1)

Modified: Nov 09 14:00:37 PST 2007 (day and time wrong)

Code used:


Thanks for considering Aspose.

We found the problem and will fix it soon.

Thank you.

1. Built in properties that return date time in Aspose.Cells and Aspose.Words return time in UTC. See the API reference.

"Gets or sets date of the document creation in UTC."

But MS Word (and I think MS Excel) show date and time in local time.

I think that could be the problem.

What timezone you are in? Are you in GMT+1? That would explain the difference for 1 hour for CreatedTime.

2. Built in properties are NOT updated by Aspose.Words (and probably by Aspose.Cells too), therefore LastSavedTime is not updated automatically. By MS Word (and MS Excel) update this property. You can update it if you want, before saving the document by setting to the current date/time.

Let me know if that helps.

1a. I knew built in properties returns date time in Aspose.Cells return time in UTC.
1b. You are correct in that MS Excel shows the date and time in local time.
1c. I am in the Pacific time zone so right now I am GMT-8. The create time would have been in GMT-7 while the modified time would have been in GMT-8. Maybe that would explain the 1 hour difference? Since the create and modify times are in UTC I would expect them to be immune to daylight savings time shifts here in the US. My Java code defaults to converting UTC time to local time.

2. For my usage, the Excel file I am processing was modified by MS Excel so the LastSavedTime would have been automatically updated. Your point is well taken in that I will have to remember to update the LastSavedTime in projects where I modify the Excel file.

Thanks for the great support!