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

Free Support Forum - aspose.com

LastSavedTime value is displayed in australia time zone value

I created document and set LastSaveTime and save the document

Document templateDocument = new Document(strTemplateFilePath);
templateDocument.BuiltInDocumentProperties.LastSavedTime = DateTime.Now;
templateDocument.UpdateFields();
templateDocument.Save(streamDocument, SaveFormat.Docx);

But when I see the document property it displays wrong time as shown below
image.png (1.3 KB)

Please suggest

@manig,

Maybe you should specify the culture info before running that code:

CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-AU"); 

In case the problem still remains, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Aspose.Words 19.3 generated output document showing the undesired behavior
  • Your expected document showing the correct behavior. You can create expected document by using MS Word.
  • Please also create a simplified standalone console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start further investigation into your issue and provide you more information. Thanks for your cooperation.

Thanks for your reply
I applied the current culture, still it is not working.
Herewith I have attached the Console application, Input & Expected Document.
ImputAndOutput.zip (551.4 KB)
SaveWord.zip (222.1 KB)

@manig,

Can you please also list the steps that you used to verify that date time value is actually written in Australian time zone? How can we verify it on our end. Thanks for your cooperation.

In the document property the changed date is in Australian time zone(in Image.png)

@manig,

We have logged your problem in our issue tracking system. Your ticket number is WORDSNET-18415. We will further look into the details of this problem and will keep you updated on the status of the linked issue.

@manig,

Regarding WORDSNET-18415, we have completed the work on your issue and concluded to close this issue as ‘Not a Bug’. Please see the following analysis details:

The code below sets local time:

templateDocument.BuiltInDocumentProperties.LastSavedTime = DateTime.Now;

However according to BuiltInDocumentProperties.LastSavedTime property, it must be time in UTC. So, with this code we see valid time in MS Word:

templateDocument.BuiltInDocumentProperties.LastSavedTime = DateTime.Now.ToUniversalTime();

Hope, this helps.

@awais.hafeez
Thanks for you input. It is working now.