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

Free Support Forum - aspose.com

CreatedTime and LastSavedTime is incorrect for output DOCX and PDF usnig .NET

Hi,
I have an orignal file (docx file) that I want to generate in DOCX and PDF with some of its BuiltInDocumentProperties modified.
The problem is that for :
==> the docx output, The dates are correct but not the time
==> the PDF output, there are no problems. ALl is fine, date and time

This was done with Aspose.Words version : 20.6

All the elements are in the zip file, and all the explanations are in the word file explanations.docx
Thanks.

elements.zip (108.6 KB)

@julien.mevel.isilog

Provide information about your specific culture, such as the name of the culture, language and country/region. We will investigate the issue and provide you more information on it.

Hi,
I’am from FRANCE.
==> System.Globalization.CultureInfo.CurrentCulture : {fr-FR}
Here is a scrennshot of the : System.Globalization.CultureInfo.CurrentUICulture

Screenshot_1.png (11.9 KB)

Thanks

@julien.mevel.isilog

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-20743 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@julien.mevel.isilog

If you set LastSavedTime explicitly, you should not set UpdateLastSavedTimeProperty. Please remove this property from the code

UpdateLastSavedTimeProperty = true

MS Word converts datetime properties to local time, so you need to use UTC time. The code should use DateTime.UtcNow and be as follow

System.DateTime newdate = DateTime.UtcNow.AddDays(-5);
System.DateTime modifydate = DateTime.UtcNow.AddDays(-2);

If this wont help, please provide us the result of the following code

Console.WriteLine(TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now).ToString());