Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Mon Jun 03, 2024 8:40 pm

I am using Spire.Doc to extract last modified date of word document.

Here is the code I am using.

Document document = new Document();
document.LoadFromFile(path);
var lastModifiedDate = document.BuiltinDocumentProperties.LastSaveDate;

Issue is that last save date I get is not accurate. It adds 4 hours to last modified date. If I open word file and go to file->Info->Last Modified date it says 5/15/2024 3:41 PM while return value from above code is 5/15/2024 7:41 PM.

I tried several word files with different modified date. Every time it add exactly 4 hours to output.

It could be because of UTC time conversion as UTC time should be 4 hours ahead of Eastern Standard Time during day light saving.

How do I get correct modified date using Spire.Doc?

dhavalsonani
 
Posts: 1
Joined: Mon Jun 03, 2024 8:29 pm

Tue Jun 04, 2024 6:10 am

Hello,

Thanks for your inquiry.
Yes, document.BuiltinDocumentProperties.LastSaveDate returns the UTC time. To convert to local time, you can use "document.BuiltinDocumentProperties.LastSaveDate.ToLocalTime();" If you have any questions, please feel free to write to us.

Sincerely
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 419
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.Doc