Different time format in doc and pdf

Hi,

I have an issue with time formatting. When I save the attached dotx to doc and pdf - they differ. We would like to have the formating in pdf the same as in doc (12 hour formatting).

Field_Time_336317.zip (13.0 KB)

var document = new Document(“Field_Time_336317.dotx”);

        document.Save("Output.doc");
        document.Save("Output.pdf");

Could you please advise?

Thanks,
Ewa

@acturisaspose,

Thanks for your inquiry. After an initial test with the latest version of Aspose.Words for .NET i.e. 18.6, we were unable to reproduce this issue on our end (please see 18.6.zip (16.0 KB)). We would suggest you please upgrade to the latest version of Aspose.Words for .NET. Hope, this helps.

Hi,

We have the latest version of Aspose Words (18.6) and I still can replicate the issue.

In Doc we have got:
9:25 AM
In Pdf:
09:25

Could you tell me which format you have got in both?

Thanks,
Ewa

@acturisaspose,

MS Word 2016 shows 4:22 PM for “Field_Time_336317.dotx”. I have converted this DOTX file to PDF by using the following code and Adobe Acrobat Reader DC again shows it as 4:22 PM.

Document doc = new Document("D:\\temp\\Field_Time_336317.dotx");
doc.Save("D:\\Temp\\18.6.pdf");

See output: 18.6.pdf (14.2 KB)

Thanks for investigation. It turned out it depends on local settings for pdf, whereas not for Word.

Thanks,
Ewa

@acturisaspose,

It is great that you were able to find what you were looking for. Please let us know any time you have any further queries.

DateFormatting.zip (59.5 KB)

Hello,
after some confirmation from our business analysts it turns out that we can’t use the workaround Ewa mentioned above.
I have done some more testing and it seems that Aspose is not mimicking Word behavior in this case.
I have attached input and output files and this is the code i was testing with (using Aspose.Words 18.10 library):

var document = new Document(“InputFiles/(1288332659) Field_Time_336317.docx”);
document.Save(“OutputFiles/Date.docx”);
document.Save(“OutputFiles/Date.pdf”);

To be able to replicate this you will need to set your system Date and Time formatting in Control Panel > Clock and Region > Change date, time or number formats.
please switch short time to HH:mm and long time to HH:mm:ss

after setting this you should be able to replicate our issue (time in PDF being displayed in 24 hrs format instead of 12 h as set in word document)

Just as a double check - if we opened either .dotx or .docx file in word and just saved it in PDF format, time setting were preserved and displayed correctly in 12 h format.

Could you please take a look?

Thanks
Aga

@acturisaspose,

Thanks for the details. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-17615. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-17615) have been fixed in this Aspose.Words for .NET 19.1 update and this Aspose.Words for Java 19.1 update.